pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chester Carlton Young <chestercyoung@yahoo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Long-running DELETE...WHERE...
Date: Mon, 14 Jan 2002 18:04:15 -0800 (PST)
Message-ID: <20020115020415.45801.qmail@web12702.mail.yahoo.com> (raw)
In-Reply-To: <21141.1011057670@sss.pgh.pa.us>

Nice syntax.  Could not find in doc.  Do you have any ideas where I
could find it?

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> jboes@nexcerpt.com (Jeff Boes) writes:
> > My situation: table A has 200,000 rows. I've made up a temporary
> table
> > which holds the single-valued primary key for 80,000 rows which I
> want
> > to delete.
> >   DELETE FROM a WHERE id IN (select ID from tmp LIMIT 800);
> > runs for several minutes.
> 
> WHERE ... IN ... is notoriously inefficient.  I'd try
> 
> 	DELETE FROM aa WHERE id = tmp.id;
> 
> which is not standard SQL but should be able to produce a decent
> plan.
> 
> You might find that a VACUUM ANALYZE on both tables beforehand would
> be
> a good idea, too; never-vacuumed temp tables have some default
> statistics assumed that are a lot less than 80k rows.
> 
> 			regards, tom lane
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



view thread (5+ messages)  latest in thread

Message-ID: <20020115020415.45801.qmail@web12702.mail.yahoo.com>
Permalink:  ../20020115020415.45801.qmail@web12702.mail.yahoo.com/
Also on:    postgresql.org/message-id/20020115020415.45801.qmail@web12702.mail.yahoo.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chestercyoung@yahoo.com, tgl@sss.pgh.pa.us
  Subject: Re: Long-running DELETE...WHERE...
  In-Reply-To: <20020115020415.45801.qmail@web12702.mail.yahoo.com>

* 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