Re: Better way to test if exist
Posted in 2000
From: "Obnoxio The Clown" <obnoxio@hotmail.com>
>
>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 tried this on 100 million rows with a spread of 32768 values and found no
perceptible difference in performance. However, even given that my server is
undergoing crucifixion by data load, I still got response times of around 1
- 1.5 seconds (most of which involved getting dbaccess to start.) What do
you mean by slow?
>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