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

Used query for history suboptimal and slow

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 2.0.3
    • Server (S)

      It appears that the used query:
      ===
      select value from history_uint where itemid=16617 and clock>1353413817 and clock<=1353417417 order by clock desc limit 2
      ===

      is extremely slow. Its hitting the MySQL "slow query" limit (it takes 80+ seconds to execute) and causing our Zabbix server to have a high load and become generally unresponsive.
      One of our developers have optimized this query, which turned this slow query into one that executes within a second:
      ===
      select t.value
      from (select value, clock
      from history_uint
      where itemid=16617) t
      where 0 < IF(t.clock between 1353413817 and 1353417417, 1, 0)
      order by t.clock desc
      limit 3;
      ===

      Its probably a good idea to update this query in Zabbix by-default?

            Unassigned Unassigned
            se_frank Frank
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: