pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Richards <michael@fastmail.ca>
Cc: pgsql-hackers@postgreSQL.org
Cc: pgsql-sql@postgreSQL.org
Subject: Re: Conditional query plans.
Date: Thu, 19 Oct 2000 19:49:09 -0400
Message-ID: <12798.971999349@sss.pgh.pa.us> (raw)
In-Reply-To: <39EF613E.000005.22998@frodo.searchcanada.ca>
References: <39EF613E.000005.22998@frodo.searchcanada.ca>

"Michael Richards" <michael@fastmail.ca> writes:
> The second and probably less optimal plan would be to create a hash 
> of these 25 answers and do a sequential scan on users updating rows 
> where id is found in that hash.

Given the presence of the "materialize" nodes, I don't think this query
plan is quite as nonoptimal as you think, especially for ~25 rows out of
the subplan.  It's a linear search over a 25-entry table for each outer
row, but so what?  With hundreds or thousands of rows out of the
subquery, it'd be nice to have a smarter table lookup method, agreed,
but here it hardly matters.

Something that's been on the todo list for a long time is to try to
convert WHERE foo IN (SELECT ...) queries into some kind of join,
instead of a subselect.  With that approach we'd be able to use merge
or hash strategies to match up inner and outer rows, which'd work a lot
better when there are large numbers of rows involved.  It might actually
happen for 7.2...

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <12798.971999349@sss.pgh.pa.us>
Permalink:  ../12798.971999349@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12798.971999349@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael@fastmail.ca, pgsql-hackers@postgreSQL.org
  Subject: Re: Conditional query plans.
  In-Reply-To: <12798.971999349@sss.pgh.pa.us>
  References: <39EF613E.000005.22998@frodo.searchcanada.ca> <12798.971999349@sss.pgh.pa.us>

* 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