pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Joseph Shraibman <jks@selectacast.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: two seperate queries run faster than queries ORed
Date: Mon, 22 Mar 2004 11:32:30 -0800 (PST)
Message-ID: <20040322113002.D62908@megazone.bigpanda.com> (raw)
In-Reply-To: <405F37CE.9070302@selectacast.net>
References: <c3d3sm$fdg$1@news.hub.org>
	<200403221655.28667.dev@archonet.com>
	<405F2893.5090805@selectacast.net>
	<6875.1079979859@sss.pgh.pa.us>
	<405F37CE.9070302@selectacast.net>


On Mon, 22 Mar 2004, Joseph Shraibman wrote:

> Tom Lane wrote:
> > Joseph Shraibman <jks@selectacast.net> writes:
> >
> >>No, pkey is not the primary key in this case. The number of entries in u
> >>that have pkey 260 and not boolfield is 344706.
> >
> >
> > ... and every one of those rows *must* be included in the join input,
>
> *If* you use one big join in the first place.  If postgres ran the query
> to first get the values with status == 3 from u, then ran the query to
> get the entries from d, then combined them, the result would be the same
> but the output faster.  Instead it is doing seq scans on both tables and

Well, you have to be careful on the combination to not give the wrong
answers if there's a row with u.status=3 that matches a row d.status=3.



view thread (8+ messages)  latest in thread

Message-ID: <20040322113002.D62908@megazone.bigpanda.com>
Permalink:  ../20040322113002.D62908@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040322113002.D62908@megazone.bigpanda.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-performance@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, jks@selectacast.net, tgl@sss.pgh.pa.us
  Subject: Re: two seperate queries run faster than queries ORed
  In-Reply-To: <20040322113002.D62908@megazone.bigpanda.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