Re: Short-circuit does not appear to be working
From: Joe Celko (jcelko212_at_earthlink.net)
Date: 10/16/04
- Next message: Joe Celko: "Re: Simple merging question..."
- Previous message: Jonathan Furman: "Re: Strange behavior with identity columns...any advice?"
- In reply to: Thomas C: "Re: Short-circuit does not appear to be working"
- Next in thread: Itzik Ben-Gan: "Re: Short-circuit does not appear to be working"
- Messages sorted by: [ date ] [ thread ]
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!
- Next message: Joe Celko: "Re: Simple merging question..."
- Previous message: Jonathan Furman: "Re: Strange behavior with identity columns...any advice?"
- In reply to: Thomas C: "Re: Short-circuit does not appear to be working"
- Next in thread: Itzik Ben-Gan: "Re: Short-circuit does not appear to be working"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|