Re: WHERE 1=2 with performance nightmares



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



.



Relevant Pages

  • Re: kbmMemTable v. 5.70 has been released!
    ... Because of that I gave you the information about browser and OS. ... blogs.myc4d.com - Your access to code tidbits and comments ... Application server enabling technology for developers ... Believe it or not - the web design managed to make me overlook the shop ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: WHERE 1=2 with performance nightmares
    ... Its perfectly valid to only use the metadata and return no records. ... blogs.myc4d.com - Your access to code tidbits and comments ... Application server enabling technology for developers ... Open Edition users, get 6.0.1.6 from http://mers.com ...
    (borland.public.delphi.non-technical)
  • Re: Need MemTable Recomendations
    ... blogs.myc4d.com - Your access to code tidbits and comments ... Application server enabling technology for developers ... do a Select to load a MemTable with the data I need to edit. ... creating the SQL update statement is of greater importance. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Looking for super fast CSV parser
    ... blogs.myc4d.com - Your access to code tidbits and comments ... Application server enabling technology for developers ... I'm going to have to look for faster StrToFloat() and EncodeDate(), ...
    (borland.public.delphi.thirdpartytools.general)