Re: [HACKERS] Performance issue with libpq prepared queries on 9.3 and 9.4

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sam Saffron <sam(dot)saffron(at)gmail(dot)com>, PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Performance issue with libpq prepared queries on 9.3 and 9.4
Date: 2014-11-17 19:08:39
Message-ID: CA+TgmoagouLzj6bzb-wcQDqO2bsZ=0CRY1jay=vFtbzUbGde9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Nov 13, 2014 at 7:34 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> One thing that occurs to me is that if the generic plan estimate comes
> out much cheaper than the custom one, maybe we should assume that the
> generic's cost estimate is bogus. Right offhand I can't think of a reason
> for a custom plan to look worse than a generic one, unless there's a
> statistical quirk like this one.

That's an interesting idea, but what do we do after deciding that it's
bogus? The generic plan really can't be cheaper than the custom plan,
but it could be the same price, or as close as makes no difference.

I have long thought that maybe the custom vs. generic plan decision
should have something to do with whether the parameters are MCVs of
the table columns they're being compared against. This case is
interesting because it demonstrates that querying for a *non*-MCV can
require a switch to a custom plan, which is something I don't think
I've seen before.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-11-17 21:27:17 Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4
Previous Message Jeff Janes 2014-11-17 18:14:03 Re: ERROR: Corrupt ascii-armor

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-11-17 19:31:41 Re: WAL format and API changes (9.5)
Previous Message David Rowley 2014-11-17 19:08:13 Re: using custom scan nodes to prototype parallel sequential scan