I need to speed up a search, big time.

I have an application that searches for records on a date field.  If it
doesn't find an exact date match, it keeps searching adjacent days until it
finds a certain amount of records.

The problem now is, I'm using my application to loop through and run
multiple queries and it's dog ass slow..    I'm hoping that one of you SQL
gurus can point me in the right direction to create a query that will work
it out for me.  Here's the logic the best I can explain..

I want to return a minimum of 15 records..  I'm searching for records on or
around 2005-10-01

Select * from table_x where row_date = '2005-10-01'
/* at this point if matched records are >= 15 then simply return the records
on that date..  If not..*/
Select * from table_x where row_date = '2005-09-31'

Select * from table_x where row_date = '2005-10-02'

And so on until it finds >= 15 records or it searches through 5 days (+- 3
on search date)

I hope this makes sense..  I'm new to all this stuff.

Eventually I'm going to do the same thing for times as well..

Thanks in advance for any help!

Cory Robin
SkyVantage



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to