pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: No hash join across partitioned tables?
Date: Thu, 16 Apr 2009 19:30:51 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0904161921080.11937@leary.csoft.net> (raw)
In-Reply-To: <7163.1239923531@sss.pgh.pa.us>
References: <Pine.BSO.4.64.0904161836540.11937@leary.csoft.net>
	<7163.1239923531@sss.pgh.pa.us>



On Thu, 16 Apr 2009, Tom Lane wrote:

> Kris Jurka <books@ejurka.com> writes:
>> PG (8.3.7) doesn't seem to want to do a hash join across two partitioned
>> tables.
>
> Could we see the whole declaration of these tables?  (pg_dump -s output
> would be convenient)
>

The attached table definition with no data wants to mergejoin first, but 
after disabling mergejoin it does indeed do a hashjoin.

Looking back at the cost estimates for the merge and nestloop joins, it 
seems to be selecting the number of rows in the cartesian product * .005 
while the number of output rows in this case is 2437 (cartesian product * 
4e-9).  Perhaps the cost estimates for the real data are so high because 
of this bogus row count that the fudge factor to disable mergejoin isn't 
enough?

Kris Jurka

Attachments:

hash-join-partition.sql (text/plain, 2.5K) download CREATE TABLE impounds ( vin character varying(17) NOT NULL, impounddate date NOT NULL, eventtypeid integer NOT NULL, ori character varying(9), platenumber character varying(8), platestate character varying(2), plateyear integer, platetype character varying(2), vehicleyear integer, vehiclemake text, vehiclemodel text, vehiclestyle text, vehiclecolor text, townotes text, damagenotes text, platenotes text, custodynotes text, sourcenotes text, referencenumber1 text, referencenumber2 text, referencenumber3 text, contactname text, contactphone text ); ALTER TABLE ONLY impounds ADD CONSTRAINT impounds_pk PRIMARY KEY (vin, impounddate, eventtypeid); CREATE TABLE impounds_s1 () INHERITS (impounds); CREATE TABLE impounds_s2 () INHERITS (impounds); CREATE TABLE impounds_s3 () INHERITS (impounds); CREATE TABLE impounds_s4 () INHERITS (impounds); ALTER TABLE impounds_s1 ADD CONSTRAINT impounds_s1_pk PRIMARY KEY (vin, impounddate); ALTER TABLE impounds_s2 ADD CONSTRAINT impounds_s2_pk PRIMARY KEY (vin, impounddate); ALTER TABLE impounds_s3 ADD CONSTRAINT impounds_s3_pk PRIMARY KEY (vin, impounddate); ALTER TABLE impounds_s4 ADD CONSTRAINT impounds_s4_pk PRIMARY KEY (vin, impounddate); CREATE TABLE liens ( agentid integer NOT NULL, vin character varying(17) NOT NULL, liendate date, accountnumber character varying(50), customername character varying(50), state character varying(2), vehiclemake character varying(20), vehiclemodel character varying(20), vehicleyear integer ); ALTER TABLE ONLY liens ADD CONSTRAINT liens_pk PRIMARY KEY (vin, agentid); CREATE TABLE liens_s1 () INHERITS (liens); CREATE TABLE liens_s2 () INHERITS (liens); CREATE TABLE liens_s3 () INHERITS (liens); CREATE TABLE liens_s4 () INHERITS (liens); CREATE TABLE liens_s5 () INHERITS (liens); CREATE TABLE liens_s6 () INHERITS (liens); CREATE TABLE liens_s7 () INHERITS (liens); ALTER TABLE liens_s1 ADD CONSTRAINT lines_s1_pk PRIMARY KEY (vin); ALTER TABLE liens_s2 ADD CONSTRAINT lines_s2_pk PRIMARY KEY (vin); ALTER TABLE liens_s3 ADD CONSTRAINT lines_s3_pk PRIMARY KEY (vin); ALTER TABLE liens_s4 ADD CONSTRAINT lines_s4_pk PRIMARY KEY (vin); ALTER TABLE liens_s5 ADD CONSTRAINT lines_s5_pk PRIMARY KEY (vin); ALTER TABLE liens_s6 ADD CONSTRAINT lines_s6_pk PRIMARY KEY (vin); ALTER TABLE liens_s7 ADD CONSTRAINT lines_s7_pk PRIMARY KEY (vin);

view thread (9+ messages)  latest in thread

Message-ID: <Pine.BSO.4.64.0904161921080.11937@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0904161921080.11937@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0904161921080.11937@leary.csoft.net

 · 

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-performance@postgresql.org
  Cc: books@ejurka.com, tgl@sss.pgh.pa.us
  Subject: Re: No hash join across partitioned tables?
  In-Reply-To: <Pine.BSO.4.64.0904161921080.11937@leary.csoft.net>
  References: <Pine.BSO.4.64.0904161836540.11937@leary.csoft.net> <7163.1239923531@sss.pgh.pa.us> <Pine.BSO.4.64.0904161921080.11937@leary.csoft.net>

* 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