Yes,I realized,thanks. My post is to try to understand speed issues behind
an existence query. Once I understand that better... then the portability,
and how that will come into play in DBI, can come next. :-)
So, just to reiterate, what I'm after is this... if the following query
returns 1 million rows:
select * from some_table where some_column = 'some_value'
then, for sure:
select count(*) from some_table where some_column = 'some_value'
accesses all pages on the disk that contain those rows.
but, does this (Sybase specific) query:
select 1 where exists
( select * from some_table where some_column = 'some_value')
and/or this Oracle specific query:
select 1 from dual where exists
( select * from some_table where some_column = 'some_value')
access all pages on the disk that contain those rows? Or, does it stop
after visiting the first row that matches?
If so, then with the next to nothing additional work of creating a "DUAL"
table in Sybase you would get the portability that you desire. And, so long
as exists keyword is same in all the major RDBMS' than the addition of the
dual table would be all that is needed for complete portability.
> -----Original Message-----
> From: M.W. Koskamp [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 08, 2001 11:52 AM
> To: Tim Harsch; Thomas A. Lowery; [EMAIL PROTECTED]
> Subject: Re: Checking for the existence of a certain row.
>
>
> >
> > SYBASE::
> > select 1 where exists
> > ( select * from some_table where some_column = 'some_value')
> >
> > Anyway, it's obviously not as portable as any of the other methods, but
> I'm
> > just trying to brainstorm the possibilities of the best methods for an
> > existence lookup.
>
> Most portable is:
>
> select count(*) from some_table where some_column = 'some_value'
>
> As i posted before.
> Will give you an integer.
> Any integer that is not 0 is a true value to Perl.
>
> Maarten.
>
>