Re: WHERE 1=2 with performance nightmares



Kim Madsen wrote:

Usually the expression compiler will evaluate the expression to be
false, even before actually searching records.

On further thought, doing might violate the SQL standard, which
requires that an error be returned consistently, regardless of
optimization. Hence, if a selectable procedure was going to return an
error without the optimization, it must return the same error with the
optimization, and, practically speaking, the only way to do that would
be to run the query to completion.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
.



Relevant Pages

  • Re: much optimizing = bad code ? (array/vector)
    ... > factor of three or more in execution time, ... if I don't get 5 or 6 times the speed after optimization I'm ... I'm not sure how you can ever say "regardless of how the program might ... no compiler is ever going to make a bubble sort run ...
    (comp.lang.cpp)
  • Re: Loop Optimization, Array Alignment
    ... The compiler (regardless of which one) can't do this. ... > actually numerically different from your original loop. ... > theory a compiler could perform the optimization as you have done it. ...
    (comp.lang.c)
  • Re: FOR loops running backwards
    ... IIRC For loop control variable optimization happens ... regardless of optimization being on or off. ... as much as a code structure - its much simpler for the compiler to generate ...
    (alt.comp.lang.borland-delphi)