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

Not optimal sql query

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 2.4.7rc1
    • Frontend (F)
    • Oracle DB

      In frontend I found not optimal sql query for Oracle.
      SELECT * FROM (SELECT FROM history_uint h WHERE h.itemid='373778' ORDER BY h.clock DESC) WHERE rownum BETWEEN 0 AND 1
      This is too slow.(~300sec on my db)

      I applied the workaround.
      SELECT * FROM history_uint h WHERE h.itemid='373778' and h.clock = (SELECT max(h2.clock) FROM history_uint h2 WHERE h2.itemid='373778')
      This query executed about 0.5-2 sec.

            Unassigned Unassigned
            andrey.dudin Andrey Dudin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: