Hi,
I would like to introduce new index for the SMS table.
I've run benchmarks using test database with about 8500 records in both SMS and Subscriber tables. Introducing SMS(dest_addr) index reduces execution time 4 times for this benchmark.
As far as I can see, db_sms_get_unsent() gets called frequently, so real-life benefits might also be considerable, especially for the large datasets.
Patch: https://gist.github.com/ati/5ef481954f5bd38d00fc SQL queries benchmark script (python): https://gist.github.com/ati/bd03be698a89e24d8a89
Regards, Alexander