Skip site navigation (1) Skip section navigation (2)

Re: two seperate queries run faster than queries ORed

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: two seperate queries run faster than queries ORed
Date: 2004-03-22 19:32:30
Message-ID: 20040322113002.D62908@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Mon, 22 Mar 2004, Joseph Shraibman wrote:

> Tom Lane wrote:
> > Joseph Shraibman <jks(at)selectacast(dot)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.

In response to

Responses

pgsql-performance by date

Next:From: Joseph ShraibmanDate: 2004-03-22 19:40:04
Subject: Re: two seperate queries run faster than queries ORed together
Previous:From: Joseph ShraibmanDate: 2004-03-22 19:00:30
Subject: Re: two seperate queries run faster than queries ORed together

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group