Re: Short-circuit does not appear to be working

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Joe Celko (jcelko212_at_earthlink.net)
Date: 10/16/04


Date: Sat, 16 Oct 2004 06:40:46 -0700


>> Technically, yes it executes correctly. What I'm wondering is why it
is eating needless CPU cycles evaulating any part of the EXIST()
statement [predicate]. <<

A query execution plan must be able to handle ALL possible values of the
variables. How is it supposed to read the procedural code around the
query, do the substitution and come up with a reduced statement? Those
are two different execution plans and T-SQL keeps only one; look at DB2
or other more serious RDBMS products for execution plans that adjust
themselves at run time based on the parameters.

Remember T-SQL is a simple, one-pass compiler and was never intended for
application development. It is not anywhere close to an optimizing
compiler.

In the old days, Univac had a killer FORTRAN compiler that optimized
code. In one Navy benchmark, the test was a huge series of floating
point calculations which were supposed to cancel out. The IBM FORTRAN
took a few minutes to compiler and a few seconds to execute it. The
Univac compiler took forever on the compile, but reduced it to a single
WRITE statement.

--CELKO--
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Obstacles for Tcl/Tk commercial application development ?
    ... this is no problem: the compiler will refuse to ... previous message, it is impossible to check all execution paths, ... kilometers, which is clearly a type error. ...
    (comp.lang.tcl)
  • Re: FORTH: BEGIN as compile-time and no run-time?!?!?!?!? Help
    ... of the compiler for your own purposes. ... For example,] switches to compile mode and [to execute mode. ... execution tokens of its parts. ... whenever there is a 0 on the stack. ...
    (comp.lang.asm.x86)
  • Re: Attention Windows Users
    ... > So if the compiler were written to automatically include code for ... languages) that have built-in data integrity support, ... including software and hardware based protection for code execution of data. ...
    (rec.aviation.piloting)
  • Re: Benefit of not defining the order of execution
    ... the contents of the log can vary depending on the evaluation order, ... execution is that the course of execution is not well defined. ... It can vary from environment to environment, from compiler to ... we need an additional suite of coding standards. ...
    (comp.lang.c)
  • Re: LEN_TRIM performance issue
    ... A long time ago in a Fortran 66 execution profiler ... it) was called FETE, Fortran Execution Time Estimator. ... out to be input to the compiler. ...
    (comp.lang.fortran)