Re: Optimal index for date range query with order by using index for sort???

2005-10-24 Thread sheeri kritzer
Is the DATE field a timestamp column? What's your schema? What's your primary key? I ask this because the real question is, "is it safe to assume that new entries are for the current day it is inserted?" If the answer to that question is yes, you can use an id field (or an existing one) to find

Optimal index for date range query with order by using index for sort???

2005-10-24 Thread Kevin Burton
OK. I need help with the following query: SELECT * FROM PRODUCT WHERE DATE > ? ORDER BY PRICE; Basically find products created since a given date and order by prices. I could put an index of DATE, PRICE but it will have to resort to a filesort since DATE isn't a constant value. I was thin