Tim Harsch writes:
 > 
 > 
 >      Don't think so, the database would clearly have to visit every row in order
 > to know there are none that match.  

Wrong... at least for Sybase.

In a table with 4 million rows, doing a check on an indexed column:

select 1 from eC_user where exists (select * from eC_user where userId = 999999999)

Table: eC_user  scan count 0,  logical reads: (regular=0 apf=0 total=0), 
physical reads: (regular=0 apf=0 total=0),  apf IOs used=0
Table: eC_user  scan count 1,  logical reads: (regular=3 apf=0 total=3), 
physical reads: (regular=0 apf=0 total=0),  apf IOs used=0
Total writes for this command: 0

In this case it only needs to do 3 IO operations to find that no rows
match... 

Michael
-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
[EMAIL PROTECTED] - [EMAIL PROTECTED]
International Sybase User Group - http://www.isug.com

Reply via email to