mirror of https://github.com/sipwise/db-schema.git
We have to concern slow selections like this: "SELECT a.callid FROM acc a WHERE a.method = 'INVITE' GROUP BY a.callid LIMIT 0,200000;" which can take procesisng time over 10 sec (as reported in the WF ticket). As a simple solution, we can give an additional index to the 'acc' table: KEY `method_callid_idx` (`method`,`callid`) Which will give us an indexation on selecitons with the WHERE clause on 'method' column. Without the index (explain of the selection): *************************** 1. row *************************** id: 1 select_type: SIMPLE table: a type: range possible_keys: NULL key: callid_method_idx key_len: 817 ref: NULL rows: 2 Extra: Using where; Using index for group-by With the index (explain of the selection): *************************** 1. row *************************** id: 1 select_type: SIMPLE table: a type: ref possible_keys: method_callid_idx key: method_callid_idx key_len: 50 ref: const rows: 1 Extra: Using where; Using index The newer index is not to be mixed with the previously existing one: KEY `callid_method_idx` (`callid`,`method`) Change-Id: Ie8a4ab102adb8788d9e273bd5a9edf1ddbb702bfmr11.1
parent
5537943729
commit
d3445b316d
@ -0,0 +1,4 @@
|
||||
SET sql_log_bin=0;
|
||||
USE kamailio;
|
||||
|
||||
DROP INDEX method_callid_idx ON acc;
|
@ -0,0 +1,4 @@
|
||||
SET sql_log_bin=0;
|
||||
USE kamailio;
|
||||
|
||||
CREATE INDEX method_callid_idx ON acc (method,callid);
|
Loading…
Reference in new issue