Re: Using ctid column changes plan drastically

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Thomas Kellerer" <spam_eater(at)gmx(dot)net>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Using ctid column changes plan drastically
Date: 2012-08-01 16:42:28
Message-ID: 501916240200002500049322@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thomas Kellerer <spam_eater(at)gmx(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Amit Kapila 2012-08-02 11:15:15 Re: Help me develop new commit_delay advice
Previous Message Peter Geoghegan 2012-08-01 15:19:28 Re: Help me develop new commit_delay advice