Long delay when querying history log

Long delay when querying history log SearchSearch
Author Message
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6306
Registered: 08-2008
Posted on Monday, August 23, 2021 - 07:49 pm:   

An interesting question received in our support mailbox ...


quote:

We are facing some issue while try query history log type (SMS out, SMS in and SMS summit) for specific phone number with max log entries 1000 it was taking around 2/min to load the history.
Please help provide solution.

Below is our operation system and database version we are using.

Database:
MySQL-Enterprise V8.0.23,

Operation System:
Redhat Enterprise Linux 8.3

NowSMS application version:

NowSMS NextGen Version 2021.03.15


Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6307
Registered: 08-2008
Posted on Monday, August 23, 2021 - 08:05 pm:   

Hi,

To avoid such a delay, add a "Start Date" to your query. This will limit the range of records that are searched.

This is recommended, because when performing a search on a phone number, NowSMS does not look for an exact match on the phone number, instead it is looking for a substring match, which will force the database manager to scan all records for this data.

In other words, if you search for 0000, it will match 0000, 0000123, 70000, 8880000777, etc. (SQL clause LIKE '%0000%')

Specifying a "Start Date" will limit the number of records that are searched. (By comparison, max log entries=1000 limits the number of matching entries that will be returned, not the number that are searched.)

Your report is making us reconsider this behaviour in future releases, as querying for a specific phone number tends to be a frequent task. We are considering adding a database index to the From/To numbers, and searching for an exact match, which would be extremely fast. However, for now, please add a "Start Date" to limit the search range.

Regards,

Des
NowSMS Support

Add Your Message Here, or click here to start a new topic.
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image
Options: Automatically activate URLs in message
Action: