Ad Widget

Collapse

Query optimization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ad@kbc-clearing.com
    Member
    • Sep 2005
    • 77

    #1

    Query optimization

    Hi All,

    We noticed a lot of slow queries:
    # Query_time: 5 Lock_time: 0 Rows_sent: 20 Rows_examined: 771705
    select value from history_log where itemid=37884 order by id desc limit 20;

    The table history_log contains 771705 items for this item.
    For many other items, the table also contains 10-thousands of rows.

    The query would be A LOT !!! faster if it was written as follows:
    select value from history_log where itemid=37884 AND ID > 0 order by id desc limit 20;

    In this case, the second index (history_log_2) will be used.

    The same applies for other history tables.

    We have searched for this query in the source and found something in expression.c and evalfunc.c.

    Can the query be changed in the next version ?
  • fmrapid
    Member
    • Aug 2010
    • 43

    #2
    Please create a ZBXNEXT request in the support interface.

    Flag it on the version you are using.

    You can also PM richlv to make sure it gets flagged to the devs for inclusion. ;-) Everyone is interested in a faster Zabbix.

    fmrapid

    Comment

    • 0siris
      Member
      Zabbix Certified Specialist
      • Nov 2010
      • 76

      #3
      did this make it to the tracker?

      Comment

      • Jason
        Senior Member
        • Nov 2007
        • 430

        #4
        Is this the same as http://www.zabbix.com/forum/showthre...4071#post84071?

        Comment

        Working...