pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Spiegelberg, Greg <gspiegelberg@cranel.com>
To: Craig A. James <cjames@modgraph-usa.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: DELETE with filter on ctid
Date: Tue, 10 Apr 2007 09:37:34 -0400
Message-ID: <82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local> (raw)
In-Reply-To: <461AB6CF.3060202@modgraph-usa.com>

Craig,

I'm not using a TEMP TABLE in this DELETE however I have tried an
ANALYZE prior to the DELETE but it hardly makes a dent in the time.

Please look at the other follow-up email I just sent for full details.

Greg
 

-----Original Message-----
From: Craig A. James [mailto:cjames@modgraph-usa.com] 
Sent: Monday, April 09, 2007 5:58 PM
To: Spiegelberg, Greg
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] DELETE with filter on ctid

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



view thread (6+ messages)  latest in thread

Message-ID: <82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local>
Permalink:  ../82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local/
Also on:    postgresql.org/message-id/82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: gspiegelberg@cranel.com, cjames@modgraph-usa.com
  Subject: Re: DELETE with filter on ctid
  In-Reply-To: <82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local>
  References: <461AB6CF.3060202@modgraph-usa.com> <82E74D266CB9B44390D3CCE44A781ED90B6ADE@POSTOFFICE.cranel.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox