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

tr_status.php generates too many queries to the DB

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.0rc1
    • None
    • Frontend (F)
    • zabbix php frontend >=1.8.4
      Postgresql backend

      Why for generating one page are performed 200 queries to DB?
      Queries like:

      "SELECT COUNT(DISTINCT e.eventid) as rowscount FROM events e WHERE (e.objectid IN (14770)) AND ((e.objectid BETWEEN 000000000000000 AND 099999999999999)) AND e.object=0 AND e.acknowledged=0 AND (e.value IN (1)) "
      and
      "SELECT DISTINCT h.host,t.description,t.expression,t.triggerid FROM triggers t, functions f, items i, hosts h WHERE f.triggerid=t.triggerid AND i.itemid=f.itemid AND h.hostid=i.hostid AND t.triggerid=22654".

      Could be rewritten as:

      "SELECT h.hostid FROM hosts h WHERE (h.hostid IN (10070,10169,10222,10229,10216,10220,10235,10733,10234,10175,10170,10362,10117,10689,10069,10745,10171,10209,10214,10204,10225,10183,10208,10211,10210,10205,10172,10173,10206,10185,10177,10176,10236,10232,10370,10212,10174,10223,10207,10219,10215)) AND ((h.hostid BETWEEN 000000000000000 AND 099999999999999)) AND h.status IN (0,1)"?

      Why use "IN", if inside it is used only one value?

            Unassigned Unassigned
            zalex_ua Oleksii Zagorskyi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: