Re: delete duplicates takes too long

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Miguel Miranda <miguel(dot)mirandag(at)gmail(dot)com>
Cc: mmiranda(at)amnetcorp(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: delete duplicates takes too long
Date: 2009-04-25 00:51:17
Message-ID: 20090425005117.GW10358@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pavunkumar 2009-04-25 03:19:37 Re: deleting function
Previous Message Miguel Miranda 2009-04-25 00:05:08 Re: delete duplicates takes too long