pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce1@obviously.com>
To: pgsql-sql@postgresql.org
Subject: Very slow updates when using IN syntax subselect
Date: Fri, 10 Feb 2006 13:00:59 -0800
Message-ID: <43ECFF0B.80905@obviously.com> (raw)

If I do:
    select event_id from event join token using
                    (token_number) where token_status=50 and
reconciled=false limit 1;
Then:
    update event set reconciled=true where event_id={XXX};


It returns in about a second, or less.  But If I do the same thing with
the IN syntax:

    update event set reconciled=true where event_id in
    (select event_id from event join token using (token_number)
     where token_status=50 and reconciled=false LIMIT 1);

On a 4 CPU machine, 2 CPU's peg at 100%, and the request just eats CPU
forever.  Any clues what might be going on?  Help would be much
appreciated.  I'm not seeing this on all my DB's... just the important ones.

PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-20)




view thread (9+ messages)  latest in thread

Message-ID: <43ECFF0B.80905@obviously.com>
Permalink:  ../43ECFF0B.80905@obviously.com/
Also on:    postgresql.org/message-id/43ECFF0B.80905@obviously.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: bryce1@obviously.com
  Subject: Re: Very slow updates when using IN syntax subselect
  In-Reply-To: <43ECFF0B.80905@obviously.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