List:General Discussion« Previous MessageNext Message »
From:Keith C. Ivey Date:November 21 2002 11:27pm
Subject:Re: DATETIME Masking and Comparison
View as plain text  
On 21 Nov 2002, at 15:18, Hans Zaunere wrote:

> Because it seems ineffncient to me, as MySQL must be doing more work to
> calculate the range.  Even EXPLAIN tells me this, by showing that a
> less-than-optimal TYPE is being used.  Although "WHERE thecolumn =
> '2002-11-17'" doesn't yield any results, EXPLAIN shows that it's using a
> better index type.

Yes, EXPLAIN says that the type is 'range' rather than 'ref', but 
you're doing a range query.  That's the best you can get for your 
query, so there's no point in worrying about what might be optimal 
for a different sort of query.  The light for searching might be 
optimal under the lamppost rather than in the alley, but if you 
dropped your keys in the alley you have to search for them there.

If you never care about the time portion of the column, then it would 
be better to make it a DATE column, but as long as it's a DATETIME 
column then you are looking for a range of values, so 'range' is the 
best you're going to get in the EXPLAIN output.

-- 
Keith C. Ivey <keith@stripped>
Tobacco Documents Online
http://tobaccodocuments.org
Phone 202-667-6653
Thread
DATETIME Masking and ComparisonHans Zaunere21 Nov
  • Re: DATETIME Masking and ComparisonKeith C. Ivey22 Nov
    • Re: DATETIME Masking and ComparisonHans Zaunere22 Nov
      • Re: DATETIME Masking and ComparisonKeith C. Ivey22 Nov
        • Re: DATETIME Masking and ComparisonHans Zaunere22 Nov
          • Re: DATETIME Masking and ComparisonNicholas Elliott22 Nov
          • Re: DATETIME Masking and ComparisonKeith C. Ivey22 Nov
            • Re: DATETIME Masking and ComparisonHans Zaunere22 Nov
              • Re: DATETIME Masking and ComparisonKeith C. Ivey22 Nov