List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:March 11 2010 5:49pm
Subject:Re: Particular value or NULL
View as plain text  
Hi Jerry, all!


Jerry Schwartz wrote:
>> [[...]]
>>
>> Maybe:
>>
>> WHERE coalesce(x, 17) = 17
>>
>>
> [JS] Interesting suggestion, but
> 
> us-gii >select benchmark(10000000,(7=7 or null is null));
> [[...]]
> 1 row in set (0.34 sec)
> 
> us-gii >select benchmark(100000000,coalesce(null,7));
> [[...]]
> 1 row in set (2.61 sec)
> 
> It looks like COALESCE() is slower. Of course this isn't anything like a real 
> test. [[...]]

Both your statements use constants only, so they can be evaluated during
statement analysis and need not access any data.

I don't think the time relation you get here can be applied to a
statement really getting column values from a table and using them in a
predicate.


Regards,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  Joerg.Bruehe@stripped
Sun Microsystems GmbH,   Komturstraße 18a,   D-12099 Berlin
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

Thread
Particular value or NULLJerry Schwartz10 Mar
  • Re: Particular value or NULLjoao10 Mar
    • RE: Particular value or NULLJerry Schwartz10 Mar
      • Re: Particular value or NULLJoerg Bruehe11 Mar
  • Re: Particular value or NULLjoao10 Mar
    • RE: Particular value or NULLJerry Schwartz11 Mar
  • Re: Particular value or NULLMartijn Tonies10 Mar