in reply to Re: Date Ranges Question
in thread Date Ranges Question

This probably won't work as you expect. While it is definitly true interger indexes are always faster than strings, I imagine it would auctually slow things down as it applies to dates. This depends on his SQL engine though. If your using postgres your going to want to see ago for instance. SQL engines normally take dates in numerous string formats, output dates in numerous formats, and store them internally in what ever way is the most optimized - which is surely not string format.
8.5.1.4. Intervals interval values can be written with the following syntax: @ quantity unit quantity unit... direction Where: quantity is a number (possibly signed); unit is second, minute, hour, day, week, month, year, decade, century, millennium, or abbreviations or plurals of these units; direction can be ago or empty. The at sign (@) is optional noise. The amounts of different units are implicitly added up with appropriate sign accounting. Quantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10 sec'. The optional precision p should be between 0 and 6, and defaults to the precision of the input literal.
Which is all optimized by the engine.


Evan Carroll
www.EvanCarroll.com