I have a SQL that has been running for the past ye...
# suiteql
j
I have a SQL that has been running for the past year without issue that has started timing out. It runs on a scheduled script, and searches the emails sent in the last 8 hours for a certain string of text in the body of the email. Even if I reduce it to only search emails sent in the last hour, it still times out now. It’s as if the `message.message LIKE ‘%text i am looking for%’ is just taking WAY longer now. I’ve checked and the number of emails we are sending has not increased. Anyone else experiencing similar?
s
I'm guessing it's doing a full table scan. Try to use a timestamp literal for filtering the time range and see if it's faster, e.g.
WHERE lastmodifieddate >= TIMESTAMP '2024-05-07 12:00:00 UTC'
j
it was already filtering on a timestamp…. I ended up taking out the LIKE ‘%text i am looking for%’ from the WHERE clause, instead just getting all messages sent in last x hours, and checking for matching text using JS.