Re: delete based on multipart key
Posted in 1997
In article <33421BB9.2197@gte.net>, Douglas Wilson <dgwilson@gte.net> wrote:
>Rudy Fernandes wrote:
>>
>> delete from first_table
>> where a || b in ( select a || b from second_table);>
>This works, but it is not exactly efficient since it will
>not take advantage of the index on first_table columns (a,b).
>
This is odd! But true.
Funnily, if the following statement is run, the index does get
used.
select a || b from first_table
where a || b in (select a || b from second_table);
but
select * from first_table
where a || b in (select a || b from second_table);
results in a SEQUENTIAL SCAN of first_table
Isn't this an optimizer goof up? Why should a || b be treated
differently from a, b? Isn't the index (a,b) stored as a || b?
-----------------------
Rudy Fernandes
GIC, Kuwait
OL 7.20UC4, 4GL 6.04UC1
-----------------------