[Info-ingres] De-duplicate a session table

abc at google.com abc at google.com
Thu Jun 4 14:10:31 UTC 2015


I have session table  t1  with fields
key_field char(10)
data_field char(100)

The table has 100,000 rows.

Unfortunately there are duplicate rows for some of the key_fields  (the 
data is different) in a few hundred cases.

I want to keep the first row in the table for the key_field but delete 
the others (it doesn't actually matter which row is kept for each 
key_field, I just want one row per key).


I was trying something like this:

delete from session.t1 a
where a.tid not in (
select min(b.tid)
from session.t1 b
group by b.key_field )

But this never seems to finish (well I left it quite a while and it 
didn't finish, the session table took less than a minute to create).

Is there a better option?



More information about the Info-ingres mailing list