RE: Date query optimization

2003-07-02 Thread Rick Robinson
Hi Karl- I often use a unix timestamp value for my dates (an unsigned mediumint is adequate) and index that. However, using date/time functions in the where clause does have a significant impact on the execution times, even when the index is used and the EXPLAIN output appears the same. See examp

Re: Date query optimization

2003-07-01 Thread Keith C. Ivey
On 1 Jul 2003 at 10:28, Karl J. Stubsjoen wrote: > > The normal way to do a search for a range of dates would be > > > >... WHERE a.submitdate BETWEEN '2003-07-01' AND '2003-07-14'; > > > > Is that what you're looking for? > > submitdate happens to be a DATETIME field. > Your suggested query

Re: Date query optimization

2003-07-01 Thread Karl J. Stubsjoen
Keith, > The normal way to do a search for a range of dates would be > >... WHERE a.submitdate BETWEEN '2003-07-01' AND '2003-07-14'; > > Is that what you're looking for? submitdate happens to be a DATETIME field. Your suggested query doesn't pull any results. Must I convert the field first?

Re: Date query optimization

2003-07-01 Thread Keith C. Ivey
On 1 Jul 2003 at 9:25, Karl J. Stubsjoen wrote: > ROWS: 34,000 + searched > explain > select > a.submitid,a.url,a.submitdate,a.name,a.company,a.address1,a.city,a.sta > te,a.z > ipcode,a.country,a.email,a.phone,a.keywords,a.title,a.description,a.su > bmitte dby from submit as a inner join re_idx as