From: | Arnaud Lesauvage <thewild(at)freesurf(dot)fr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Index on two columns not used |
Date: | 2006-10-18 17:51:07 |
Message-ID: | 4536698B.7010001@freesurf.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Tom Lane a écrit :
> Arnaud Lesauvage <thewild(at)freesurf(dot)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 ...
gid is the primary key of the first table, so absolutely unique.
Thanks for the information Tom !
--
Arnaud
From | Date | Subject | |
---|---|---|---|
Next Message | Jim C. Nasby | 2006-10-18 19:01:18 | Re: Performance Optimization for Dummies 2 - the SQL |
Previous Message | Tom Lane | 2006-10-18 17:31:57 | Re: Index on two columns not used |