Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-13266

history.get API with lots of items is slow

XMLWordPrintable

    • Sprint 25, Sprint 26, Sprint 32, Sprint 33, Sprint 34, Sprint 35, Sprint 36, Sprint 37, Sprint 38, Sprint 39, Sprint 40, Sprint 41, Sprint 42, Sprint 43, Sprint 44, Sprint 45, Sprint 46, Nov 2018, Sprint 47, Dec 2018, Sprint 48, Jan 2019, Sprint 56 (Sep 2019), Sprint 55 (Aug 2019), Sprint 49 (Feb 2019), Sprint 50 (Mar 2019), Sprint 51 (Apr 2019), Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
    • 2

      history.get API is slow when request has lots of items, for example, a history.get request with 2000 items takes 5-8 seconds

      The cause of problem is SQL query, history.get API creates select query like:

      SELECT h.* FROM history_uint h WHERE (h.itemid BETWEEN '23740' AND '23771' OR h.itemid BETWEEN '23781' AND ...
      

      This query is much faster

      SELECT h.* FROM history_uint h WHERE h.itemid IN ('23740','23771','23781' ....);
      

        1. DATABASE PERFORMANCE TESTS.pdf
          72 kB
        2. zbx-13266.patch
          2 kB
        3. lld-data.7z
          3.32 MB

            MVekslers Michael Veksler
            kodai Kodai Terashima
            Team A
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: