pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar <gnari@hive.is>
To: Arnaud Lesauvage <thewild@freesurf.fr>
Cc: Jens Schipkowski <jens.schipkowski@apus.co.at>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow update with simple query
Date: Wed, 13 Dec 2006 14:49:00 +0000
Message-ID: <1166021340.6369.103.camel@localhost.localdomain> (raw)
In-Reply-To: <4580025D.2040903@freesurf.fr>
References: <457FDB1E.6040801@freesurf.fr>
	<op.tkhy4jpg81rjf6@xjens.apus.local>
	<457FF0CD.4050606@freesurf.fr>
	<op.tkh10qgw81rjf6@xjens.apus.local>
	<4580025D.2040903@freesurf.fr>

On mið, 2006-12-13 at 14:38 +0100, Arnaud Lesauvage wrote:
> Jens Schipkowski a écrit :
> > On Wed, 13 Dec 2006 13:23:41 +0100, Arnaud Lesauvage <thewild@freesurf.fr>  
> >> Why is this query better than the other one ? Because it runs the  
> >> "(field IN ('some','other') AND field2 = 'Y')" once and then executes  
> >> the join with the resulting set ?
> > True. The Subselect in FROM clause will be executed once and will be  
> > joined using the condition at where clause. So your condition at t2 is not  
> > executed for each row in t1(2mio records) but for each row in t2(1k  
> > records). And the boolean value is already set during update.
> 
> OK Jens, thanks for clarifying this.
> I thought the planner could guess what to do in such cases.

don't worry, it will.
this is not your problem

gnari





view thread (21+ messages)  latest in thread

Message-ID: <1166021340.6369.103.camel@localhost.localdomain>
Permalink:  ../1166021340.6369.103.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1166021340.6369.103.camel@localhost.localdomain

 · 

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-performance@postgresql.org
  Cc: gnari@hive.is, thewild@freesurf.fr, jens.schipkowski@apus.co.at
  Subject: Re: Slow update with simple query
  In-Reply-To: <1166021340.6369.103.camel@localhost.localdomain>

* 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