[Asterisk-Dev] realtime extensions db friendliness
Terry Wilson
otherwiseguy at gmail.com
Thu Apr 7 16:04:10 MST 2005
Is there any reason that the Realtime db switch is so db-unfriendly?
My extensions table contans extens for just 1,1,Answer and 1,2,Echo.
Yet, asterisk executes 10 queries for the call. Here is a log from my
posgres server for a single call using the realtime switch.
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '2'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '2'
LOG: statement: SELECT * FROM extensions WHERE exten = '1' AND
context = 'customers' AND priority = '2'
LOG: statement: SELECT * FROM extensions WHERE exten = 'h' AND
context = 'customers' AND priority = '1'
LOG: statement: SELECT * FROM extensions WHERE exten LIKE '\\_%' AND
context = 'customers' AND priority = '1' ORDER BY exten
If you had any extensions with a remotely large number of priorities
and a couple calls a second it would be definitely impact your db. 2
calls * 5 priorities * ~4 queries/priority = 40 queries per second...
as opposed to 2 if you could just grab all of the applicable
priorities in the beginning. I didn't want to open a bug if this was
the intended behavior for some reason.
More information about the asterisk-dev
mailing list