Slow seach - Possible better query

2006-10-31 Thread Albert Padley
I have a query that works and returns the correct results. However, it is very slow ( 6-12 seconds on 5000 row table). Since this table will grow to several hundred thousand rows very shortly, I am worried. Here is the query that works: SELECT id, subject, updated FROM mrldisc WHERE (id IN

Re: Slow seach - Possible better query

2006-10-31 Thread Dan Buettner
Albert, it seems like the first query could be simplified, like so: SELECT id, subject, updated FROM mrldisc WHERE updated SUBDATE(NOW(), INTERVAL 48 HOUR) ORDER BY updated DESC LIMIT 50 This might help it hit the index you've created on the UPDATED column. I know there have been bugs here

Re: Slow seach - Possible better query

2006-10-31 Thread Albert Padley
Dan, On Oct 31, 2006, at 3:41 PM, Dan Buettner wrote: Albert, it seems like the first query could be simplified, like so: SELECT id, subject, updated FROM mrldisc WHERE updated SUBDATE(NOW(), INTERVAL 48 HOUR) ORDER BY updated DESC LIMIT 50 This query won't work. The table contains

Re: Slow seach - Possible better query PROBLEM SOLVED

2006-10-31 Thread Albert Padley
Dan, Actually you were on the right track. I changed your suggested query to the following and it seems to work and is a lot quicker. SELECT id, subject, updated FROM mrldisc WHERE updated SUBDATE(NOW (), INTERVAL 48 HOUR) AND mainthread = 'T' ORDER BY updated DESC LIMIT 50 Thanks.