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

Querying some latest data causes chunk decompression for all records in historical tables

XMLWordPrintable

    • S25-W18/19
    • 1

      Steps to reproduce:

      1. Try to open some latest data for 3 hours.
      2. Get DB stuck on SQL like this.

      Result:

      SELECT h.itemid,h.value,h.clock FROM history_uint h 
      JOIN (SELECT h2.itemid,h2.clock,MAX(h2.ns) AS ns FROM history_uint h2 
      JOIN (SELECT itemid,MAX(clock) AS clock FROM history_uint WHERE itemid=50709419 AND clock>='1745856891' AND clock<='1745867691' GROUP BY itemid) s2 
      ON h2.itemid=s2.itemid AND h2.clock=s2.clock GROUP BY h2.itemid,h2.clock) s 
      ON h.itemid=s.itemid AND h.clock=s.clock AND h.ns=s.ns 
      

      Detailed explain: https://space.zabbix.com/s/LkobaxXYkngC36d

      Instead of returned 300 values, system tries to get 17 billion of records

      Enable or Disableing seq_scan option doesn't help.

      Refreshing vacuum/analyse stats has no effect also, same explain results.

      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/ui/include/classes/api/managers/CHistoryManager.php#855-873,1433-1451

      Expected:
      JOIN is not used, to avoid causing decompression of all history_uint table.

            gcalenko Gregory Chalenko
            edgar.akhmetshin Edgar Akhmetshin
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 5h
                5h