Re: A question about plans and multi-key pks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: A question about plans and multi-key pks
Date: 2015-05-01 16:43:17
Message-ID: 37752.1430498597@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk> writes:
> Why does the plan come up with 67 rows, when by definition there can be at
> most one as we are searching on the pk?

The rowcount estimate is made by combining selectivities of the WHERE
conditions; what you're seeing is a consequence of not having very good
knowledge about cross-column correlations. The actual details of the plan
(ie, that the pkey index can be used) are determined much later.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2015-05-01 17:14:17 Re: pg_dump permssion denied problem
Previous Message Steve Rogerson 2015-05-01 15:53:26 A question about plans and multi-key pks