pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Lucas Madar <madar@samsix.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Poor performance when joining against inherited tables
Date: Wed, 11 May 2011 13:00:26 -0400
Message-ID: <508.1305133226@sss.pgh.pa.us> (raw)
In-Reply-To: <BANLkTimssX0BS_ycZjye3z7TLiiiPqi8tg@mail.gmail.com>
References: <sig.50826e4e2f.4DA3608E.9090906@samsix.com>
	<BANLkTimssX0BS_ycZjye3z7TLiiiPqi8tg@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> A more interesting question is why you're not getting a plan like this:

> Nested Loop
> -> Seq Scan on objects
> -> Append
>    ->  Index Scan using xxx_pkey on itemXX
>    ->  Index Scan using yyy_pkey on itemYY
>    ->  Index Scan using zzz_pkey on itemZZ

Probably because there are 4 million rows in the objects table.

Or maybe it's a pre-8.2 database and can't even generate such a plan.
But if it did generate it, it would almost certainly have decided that
this was more expensive than a hash or merge join.

People have this weird idea that the existence of an index ought to make
enormous joins free ...

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <508.1305133226@sss.pgh.pa.us>
Permalink:  ../508.1305133226@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/508.1305133226@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, madar@samsix.com
  Subject: Re: Poor performance when joining against inherited tables
  In-Reply-To: <508.1305133226@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