Re: Better way to test if exist
Posted in 2000
Topics: General Discussion
From: Dirk Niemeier <dirk.niemeier@stueken.de>
>what is the best way to test if an duplicate value exist ?
>Example: A indexed table column char(3) with 4 different entries. But
>this 4 entries are duplicate average 1000 times.
>
>Now I tried to test like this:
>
>select distinct test_column from test_table where <column_test> = 'XXX';>
>That works fine, but it's very slow when the entry exists. Isn't there a
>better way ?
I haven't tested it, but how about:
select FIRST 1 test_column from test_table where <column_test> = 'XXX';
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Hi,
sorry. I forget to tell you that we are using Informix SE for this.
In case that the entry exists, it`s working for 1 to 2 seconds. If it doesn't
exist it's back immediately.
TIA
Dirk
Obnoxio The Clown schrieb:
> From: Dirk Niemeier <dirk.niemeier@stueken.de>
> >what is the best way to test if an duplicate value exist ?
> >Example: A indexed table column char(3) with 4 different entries. But
> >this 4 entries are duplicate average 1000 times.
> >
> >Now I tried to test like this:
> >
> >select distinct test_column from test_table where <column_test> = 'XXX';> >
> >That works fine, but it's very slow when the entry exists. Isn't there a
> >better way ?
>
> I haven't tested it, but how about:
> select FIRST 1 test_column from test_table where <column_test> = 'XXX';>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com