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

I wrote:
> [ assorted possible workarounds ]

Actually, an easy fix might be to create a 2-column index on
usagestats(type, tid).  I think the planner should be able to
use that to produce sorted output for the mergejoin, and you'd
get the best of both worlds, because the indexscan will stop
immediately when it's exhausted the rows with type = 'vehicle'.

			regards, tom lane


-- 
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)  latest in thread

Message-ID: <31348.1426777106@sss.pgh.pa.us>
Permalink:  ../31348.1426777106@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31348.1426777106@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, jakemagner90@gmail.com
  Subject: Re: Merge Join chooses very slow index scan
  In-Reply-To: <31348.1426777106@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