Re: WHERE 1=2 with performance nightmares
- From: "Kim Madsen" <kbm@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Aug 2007 17:31:14 +0200
Hi,
Usually the expression compiler will evaluate the expression to be false,
even before actually searching records.
Another way is where true=false (similar, but no potential ambiguity).
--
best regards
Kim Madsen
kbm@xxxxxxxxxxxxxxxxxxxxxxxxx
www.components4developers.com
www.myc4d.com - Your access to cool code
blogs.myc4d.com - Your access to code tidbits and comments
The best components for the best developers
Application server enabling technology for developers
"Craig Stuntz [TeamB]" <craig_stuntz@xxxxxxxxxxxxx [a.k.a. acm.org]> skrev i
en meddelelse news:46b1e43f$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Kim Madsen wrote:
Sounds like a where clause added by an api or middleware to get the
field definitions but not any records.
It's not a good idea to do it that way, since any DB without an
expression index or an explicit "optimization" for nonsense will do a
full table scan on that. It's a far better idea to use a random PK
value, since that gets you 0 or 1 records, if you must do it this way
instead of using the system tables.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of
Irish music out, and it's good: http://tinyurl.com/7hgfr
.
- Follow-Ups:
- Re: WHERE 1=2 with performance nightmares
- From: Craig Stuntz [TeamB]
- Re: WHERE 1=2 with performance nightmares
- From: Craig Stuntz [TeamB]
- Re: WHERE 1=2 with performance nightmares
- References:
- WHERE 1=2 with performance nightmares
- From: Sarah
- Re: WHERE 1=2 with performance nightmares
- From: Kim Madsen
- Re: WHERE 1=2 with performance nightmares
- From: Craig Stuntz [TeamB]
- WHERE 1=2 with performance nightmares
- Prev by Date: Re: Screen size
- Next by Date: Re: Vista and Delphi 5
- Previous by thread: Re: WHERE 1=2 with performance nightmares
- Next by thread: Re: WHERE 1=2 with performance nightmares
- Index(es):
Relevant Pages
|