MySQL Forums :: Performance :: field equal to OR between 2 fields?


Advanced Search

field equal to OR between 2 fields?
Posted by: Jason McIver ()
Date: September 11, 2009 03:48AM

Hi, I have a record table that is expected to see past 500,000 in a year or 2.
Among the fields are these 3, 'start' (date) and 'end' (date) and 'type' (int).
I'd like to check if a date matches between the 'start' and 'end' fields, as it would be the easy way out for the rest of the application, but would matching to 'type' be much quicker? or no real difference?
I guess what I'm asking is, how much difference in speed or efficiency is there between these two queries:

SELECT * FROM `records` WHERE `type` = 1

and

SELECT * FROM `records` WHERE `start` <= '2010-06-01 14:50:20' AND `end` >= '2010-06-01 14:50:34'

Jason

Options: ReplyQuote


Subject Views Written By Posted
field equal to OR between 2 fields? 3295 Jason McIver 09/11/2009 03:48AM
Re: field equal to OR between 2 fields? 4264 Rick James 09/12/2009 09:03AM
Re: field equal to OR between 2 fields? 1939 Jason McIver 09/12/2009 11:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.