Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-2887

SELECT COUNT(*) query slowing down the device page

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not A Bug
    • Minor
    • None
    • Professional Edition
    • Web Interface
    • Observium Professional

    Description

      Hello!

      For pretty long time I noticed that device page is loading slowly when the device has a lot of syslog entries, but I didn't manage to dig deeper into the problem. Today I had this time

      I noticed that /opt/observium/html/pages/device/overview/syslog.inc.php performs SELECT COUNT from `syslog` WHERE `device_id` = ? query on the syslog table and then does a query to fetch 20 syslog entries from syslog table to be shown on the device page using SELECT * FROM `syslog` WHERE 1 AND `device_id` AND ((`device_id` IS NOT NULL)) ORDER BY `seq` DESC LIMIT 0,20 query.
      Can you explain why it performs SELECT COUNT from `syslog` WHERE `device_id` = ? ? Such a query really takes a lot of time and it's output is neither displayed to the user, not used to fetch 20 rows which are actually displayed on the device page.

      For guys like me, having several security devices with tons of syslogs (namely, about 100M for all the syslog table), this SELECT COUNT may easily take 30 seconds for those devices and make network operator's job much less efficient.

      Attachments

        Activity

          People

            landy Mike Stupalov
            j-v-c Sergei Fomin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: