Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Find Empty Tables

Re: Find Empty Tables

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Fri, 30 May 2003 12:06:48 +0000
Message-ID: <bb7aiu$kg3$1@ctb-nnrp2.saix.net>


Andy wrote:

> You could try SELECT 'X' FROM DUAL WHERE EXISTS( SELECT 'X' FROM table).

Oh yeah.. forgot too mention.

Andy, I take a lead pipe to any developer that use EXISTS in SQL on any of the databases I look after. :-)

Few developers know how to correctly use it. I have witnessed numerous performance horrors because of abusing EXIST.. like doing an UPDATE and in the WHERE clause use an EXISTS. For every single row matching the short circuit boolean evaluation in the WHERE clause, a sub SQL select is run. You have a lot of rows to update, or the sub SQL does an index range scan or even a join... performance cease to exist.

My opinion - never use EXISTS unless you have a pretty darn good reason why _nothing_ else but an EXISTS will do the job. IMO, your example does not necessitate the use of an EXISTS.

--
Billy
Received on Fri May 30 2003 - 07:06:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US