Re: Selecting dupes from table

From: Hervé Piedvache <herve(at)elma(dot)fr>
To: Uros <uros(at)sir-mag(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Selecting dupes from table
Date: 2003-06-24 11:27:44
Message-ID: 200306241327.44610.herve@elma.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I think this could be good :

select d1.id, d1.url, d1.tittle
from directory d1
where exists (select url from directory d2 where d1.url=d2.url and
d2.oid>d1.oid)
order by d1.url;

Hope this will help,

Regards,

Le Mardi 24 Juin 2003 12:16, Uros a écrit :
> Hello ,
>
> I have table directory with 3 columns (id,url,title)
>
> I want to list all entries with duplicate urls.
>
> I tried this:
>
> select id,url,title from directory where url IN
> (select url from directory group by url having count(url) > 1)
> ORDER by url;
>
> but this takes 30 seconds with 25.000 entries. I have index on url.
>
> Can I use any other query to select this faster.

--
Hervé Piedvache

Elma Ingénierie Informatique
6 rue du Faubourg Saint-Honoré
F-75008 - Paris - France
Pho. 33-144949901
Fax. 33-144949902

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Uros 2003-06-24 11:40:09 Re: Selecting dupes from table
Previous Message Martijn van Oosterhout 2003-06-24 11:23:09 Re: Selecting dupes from table