Re: Selecting dupes from table - Mailing list pgsql-general

From Hervé Piedvache
Subject Re: Selecting dupes from table
Date
Msg-id 200306241327.44610.herve@elma.fr
Whole thread Raw
In response to Selecting dupes from table  (Uros <uros@sir-mag.com>)
Responses Re: Selecting dupes from table  (Uros <uros@sir-mag.com>)
List 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


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Selecting dupes from table
Next
From: Uros
Date:
Subject: Re: Selecting dupes from table