pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jake Magner <jakemagner90@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Merge Join chooses very slow index scan
Date: Thu, 19 Mar 2015 12:15:33 -0700 (MST)
Message-ID: <1426792533879-5842633.post@n5.nabble.com> (raw)
In-Reply-To: <1426783249710-5842603.post@n5.nabble.com>
References: <1426746214298-5842523.post@n5.nabble.com>
	<30571.1426775332@sss.pgh.pa.us>
	<1426783249710-5842603.post@n5.nabble.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

I think I understand now after reading the notes here on the merge join
algorithm: 

https://github.com/postgres/postgres/blob/4ea51cdfe85ceef8afabceb03c446574daa0ac23/src/backend/execu...

The index scanning node doesn't know the max id of the vehicle table and so
can't know when to stop looking for the next tuple that matches the join.
Doesn't seem like any easy way to improve that case. I imagine it is a
fairly common pattern though. Any time metadata about entities modeled in
different tables, is stored in the same table, and the distribution of the
number of each entity type is skewed, this situation will arise.

Best,
Jake



--
View this message in context: http://postgresql.nabble.com/Merge-Join-chooses-very-slow-index-scan-tp5842523p5842633.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (7+ messages)

Message-ID: <1426792533879-5842633.post@n5.nabble.com>
Permalink:  ../1426792533879-5842633.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1426792533879-5842633.post@n5.nabble.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: jakemagner90@gmail.com
  Subject: Re: Merge Join chooses very slow index scan
  In-Reply-To: <1426792533879-5842633.post@n5.nabble.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