Re: Good Informix bug found
Posted in 1996
Stuart Litel wrote:
>
> This is one of my favorite Informix bugs I have found in a while....
>
....
>
> select count(*) from table where table.date_field = "8/4/96">
> or
>
> select count(*) from table where table.date_field = today>
> the SECOND query using TODAY (or today -1 to get to the date needed)...
> is almost THREE TIMES FASTER.
>
Stuart,
I would be very interested in the result for the following.
select count(*) from table where table.date_field = date("8/4/96")
This should run as fast as using today because it compares a date with a
date. Your original query compares a date with a string so there is an
impied type conversion. I suspect that this type conversion occurs for
every single match check rather than just once for the entire query.
Not exactly a bug, certainly an area for some serious performance
enhancing code re-work.
Cheers - Jim
--
------------------------------------------------------------------------
Jim Gordon DHL Airways Inc.
jgordon@us.dhl.com
------------------------------------------------------------------------
My opinions are my own. They may vary with time but they remain mine!