Re: [NOVICE] WHERE clause not used when index is used - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [NOVICE] WHERE clause not used when index is used
Date
Msg-id 19581.1456858025@sss.pgh.pa.us
Whole thread Raw
In response to Re: [NOVICE] WHERE clause not used when index is used  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> I'm not sure if the costing change is a bug or not --- the non-bitmap scan
> does seem to be cheaper in reality, but not by a couple orders of
> magnitude as the planner now thinks.

Ah, scratch that, I wasn't looking closely enough.  The 9.4 plan is an
IndexScan whereas 9.5+ uses IndexOnlyScan, which accounts for the cost
differential.  The reason it changed is the remove_unused_subquery_outputs
patch (55d5b3c08279b487), which allows the subquery to know that it
doesn't actually have to return all columns of tenk1, so that an
index-only scan is legal.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Fixing wrong comment on PQmblen and PQdsplen.
Next
From: Robert Haas
Date:
Subject: Re: psql completion for ids in multibyte string