Re: Using ctid column changes plan drastically - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Using ctid column changes plan drastically
Date
Msg-id 501916240200002500049322@gw.wicourts.gov
Whole thread Raw
In response to Re: Using ctid column changes plan drastically  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-performance
Thomas Kellerer <spam_eater@gmx.net> wrote:

> I finally found a solution that runs fine:
>
> DELETE FROM dupes a
> WHERE EXISTS (SELECT 1
>                FROM  dupes b
>                WHERE b.first_name = a.first_name
>                  AND b.last_name = a.last_name
>                  AND b.ctid > a.ctid);

How does performance for that compare to?:

CREATE TABLE nodupes AS
  SELECT DISTINCT ON (last_name, first_name) * FROM dupes
  ORDER BY last_name, first_name, ctid;

-Kevin

pgsql-performance by date:

Previous
From: "Hugo "
Date:
Subject: Re: pg_dump and thousands of schemas
Next
From: Russell Keane
Date:
Subject: query using incorrect index