Re: WHERE 1=2 with performance nightmares
- From: "Del Murray" <Del.Murray@xxxxxxxxxxxxxx>
- Date: Thu, 2 Aug 2007 12:31:47 -0500
SQL server definitely will optimize and return no recs and no errors. I have
been using that technique for years. i have heard that it is flaky on Oracle
but not sure. Randomizing doesn't solve the problem because most of the time
we do this to get an "initialized" empty recordset which we can append
records into.
You can sometimes do select * from mytable where id = -1 and that will
work if "id" is a unique key (or primary which every good DB should have)
and the DB engine will check the PK index and return zero records, no
errors.
Randomizing *might* return 1 record, which is not good if you are trying to
update databases in batchoptimistic mode.
.
- 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]
- 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: auto-updater
- Next by Date: Re: WHERE 1=2 with performance nightmares
- Previous by thread: Re: WHERE 1=2 with performance nightmares
- Next by thread: Re: WHERE 1=2 with performance nightmares
- Index(es):