Re: delete duplicates takes too long - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: delete duplicates takes too long
Date
Msg-id 20090425005117.GW10358@alvh.no-ip.org
Whole thread Raw
In response to Re: delete duplicates takes too long  (Miguel Miranda <miguel.mirandag@gmail.com>)
Responses Re: delete duplicates takes too long
List pgsql-general
Miguel Miranda escribió:
> I cant use a unique index because i only want to check for duplicates where
> processed = 2, for simplicity i did not include that condition in the
> example.

In that case you can create a partial unique index:

create index foo on cdr_ama_stat (abonado_a, abonado_b, fecha_llamada,
duracion) where processed = 2;

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: Miguel Miranda
Date:
Subject: Re: delete duplicates takes too long
Next
From: pavunkumar
Date:
Subject: Re: deleting function