List:General Discussion« Previous MessageNext Message »
From:Vivek Khera Date:June 2 1999 2:21pm
Subject:Re: Dates querying Mysql
View as plain text  
>>>>> "MW" == Michael Widenius <monty@stripped> writes:

MW> What may confuse someone is that the simple operators: >=, >, = , <
MW> and <= does some 'extra magic' when one compares a 'date/datetime/time
MW> type' column to a constant strings to make date handling easier.  We
MW> didn't add this behaviour to the BETWEEN clause as it's harder to make
MW> a simple rule when one have 3 arguments to take care compared to two
MW> arguments.

So, when one wants to do a "between" with dates, which is the
preferred form?  Below, date_value is a column of type DATE.

a)
  where date_value BETWEEN '1999-05-01' AND '1999-05-31'

b)
  where date_value <= '1999-05-31' AND date_value >= '1999-05-01'

Which one does the faster compares?  Why not just have the parser
internally rewrite form (a) as (b) then apply the necessary rules for
optimizing date/time compares?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@stripped       Rockville, MD       +1-301-545-6996
PGP & MIME spoken here            http://www.kciLink.com/home/khera/
Thread
Dates querying MysqlClaudia M. Castaneda24 May
  • Re: Dates querying MysqlGraeme B. Davis25 May
  • Re: Dates querying MysqlChristian Mack25 May
    • Re: Dates querying MysqlClaudia M. Castaneda25 May
      • Re: Dates querying MysqlJim Faucette25 May
        • Re: Dates querying MysqlClaudia M. Castaneda25 May
          • Re: Dates querying MysqlVivek Khera25 May
        • Re: Dates querying MysqlJim Faucette25 May
          • Re: Dates querying MysqlMichael Widenius2 Jun
            • Re: Dates querying MysqlVivek Khera2 Jun
              • Re: Dates querying MysqlMichael Widenius3 Jun
Re: Dates querying MysqlVivek Khera2 Jun