pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Arnaud Lesauvage <thewild@freesurf.fr>
Cc: pgsql-performance@postgresql.org
Subject: Re: Index on two columns not used
Date: Wed, 18 Oct 2006 13:31:57 -0400
Message-ID: <28276.1161192717@sss.pgh.pa.us> (raw)
In-Reply-To: <45360E25.9010403@freesurf.fr>
References: <45360E25.9010403@freesurf.fr>

Arnaud Lesauvage <thewild@freesurf.fr> writes:
> When I join these two tables, the 2-column index of the first table is 
> not used.
> Why does the query planner think that this plan  is better ?

Hm, is gid by itself nearly unique in these tables?  If so, the merge
join would get only marginally more efficient by using both columns as
merge conditions.  Heikki's probably right to guess that the planner
thinks it's better to use the smaller index.

However, if there are lots of duplicate gids, then it ought to have
preferred the two-column merge ...

			regards, tom lane



view thread (16+ messages)  latest in thread

Message-ID: <28276.1161192717@sss.pgh.pa.us>
Permalink:  ../28276.1161192717@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28276.1161192717@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, thewild@freesurf.fr
  Subject: Re: Index on two columns not used
  In-Reply-To: <28276.1161192717@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