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 ?
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 ?
Comment