Re: DELETE with filter on ctid

From: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
To: "Spiegelberg, Greg" <gspiegelberg(at)cranel(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: DELETE with filter on ctid
Date: 2007-04-09 21:57:35
Message-ID: 461AB6CF.3060202@modgraph-usa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Spiegelberg, Greg wrote:
> We have a query which generates a small set of rows (~1,000) which are
> to be used in a DELETE on the same table. The problem we have is that
> we need to join on 5 different columns and it takes far too long.

You may have encountered the same problem I did: You *must* run ANALYZE on a temporary table before you use in another query. It's surprising that this is true even for very small tables (a few hundred to a few thousand rows), but it is. I had a case where I created a "scratch" table like yours, and the before/after ANALYZE performance was the difference between 30 seconds and a few milliseconds for the same query.

Craig

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message s d 2007-04-10 00:45:53 Re: Beginner Question
Previous Message Tom Lane 2007-04-09 21:43:42 Re: how to efficiently update tuple in many-to-many relationship?