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

Heavy SQL query with huge output in the create() and update() methods for item, item prototype and discovery rule classes

    XMLWordPrintable

    Details

    • Team:
      Team B
    • Sprint:
      Sprint 27, Sprint 28, Sprint 29, Sprint 30, Sprint 31, 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
    • Story Points:
      3

      Description

      The SQL statement in itemgeneral.checkInput () has an SQL statement that can return a huge amount of data.

      For example, when updating an item in the template with three items, linked to ~22000 hosts produces an array with 66030 elements which consume 51352040 bytes of the memory.

      frontends/php/include/classes/api/services/CItemGeneral.php:575

      $host_items = $this->get([
          'output' => ['itemid', 'type', 'key_', 'master_itemid', 'hostid'],
          'filter' => ['hostid' => $all_hostids],
          'preservekeys' => true
      ]);
      SQL (2.339933): SELECT i.itemid,i.type,i.key_,i.master_itemid,i.hostid FROM items i WHERE i.type<>9 AND i.flags IN (0,4) AND (i.hostid BETWEE...

      Also, this SQL statement shouldn't be executed for lld rules, since it is used for validation of dependent items and item prototypes.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sasha Alexander Vladishev
              Reporter:
              sasha Alexander Vladishev
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: