Yeah I thought about that too right at the end of my response.  It sounds
like he didn't have an index.

> -----Original Message-----
> From: Michael Peppler [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 10:48 AM
> To: Tim Harsch
> Cc: Ronald J Kimball; M.W. Koskamp; Thomas A. Lowery; [EMAIL PROTECTED]
> Subject: RE: Checking for the existence of a certain row.
>
>
> 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