On Thu, Dec 02, 2004 at 07:11:29 +0100, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: > I have a table where I need to use "..where curdate between fromDate and > toDate". > Is it best to have two indexes, one for FromDate and one for toDate or just > one index for both the fields?
Assuming that curdate is something like the date when the query is being run and that FromDate and toDate are columns in the table you are searching, then you probably want indexes on each column. A combined index scan wouldn't be useful. An index scan on either FromDate or toDate might be useful depending on the distribution of values in those columns and the value of curdate. ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster