Very long SQL when adding a new host

XMLWordPrintable

    • Type: Incident report
    • Resolution: Fixed
    • Priority: Major
    • 1.8.2
    • Affects Version/s: 1.8, 1.9.0 (alpha)
    • Component/s: Frontend (F)
    • None
    • Environment:
      1.8

      When adding a host Zabbix generates very long SQL statement, which runs very slow under PostgreSQL:

      Time:42.283658 LONG SQL: SELECT hostid FROM hosts_templates WHERE (templateid IN (10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,
      10057,10058,10059,10060,10061,10062,10063,10064,10065,10066,10067,10068,10069,10070,
      10071,10072,10073,10074,10075,10076,10077,10078,10079,10080,10081,10082,10083,10084,10085,10086,10087,10088,10089,10090,10091,10092,10093,10094,10095,10096,
      10097,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,
      10123,10124,10125,10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,10141,10142,10143,10144,10145,10146,10147,10148,
      10149,10150,10151,10152,10153,10154,10155,10156,10157,10158,10159,10160,10161,10162,10163,10164,10165,10166,10167,10168,10169,10170,10171,10172,10173,10174,
      10175,10176,10177,10178,10179,10180,10181,10182,10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,10193,10194,10195,10196,10197,10198,10199,10200,
      10201,10202,10203,10204,10205,10206,10207,10208,10209

      Further research revealed that the function where the SQL is used is not correct, the logic is broken. Please fix it and make it much more efficient.

            Assignee:
            Unassigned
            Reporter:
            Alexei Vladishev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: