On Fri, 2003-08-01 at 09:15, Jeremy Browne wrote:
> I was reading in my SQL book about optimizing queries, and it came to me 
> that MySQL date fields may not be the way to go.
> 
> For example, if you have "year(date_col) = 1990" in your where clause, MySQL 
> will not use an index because it must calculate year for each date_col 
> value.

The optimal way to do that is "where date_col >= '1990-01-01' and
date_col < '1991-01-01'".  This is MUCH more optimal than handling it in
your PHP...

Steve


____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to