Re: Queries are taking way longer in 9.6 than 9.5

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Melvin Davidson <melvin6925(at)gmail(dot)com>, Ravi Tammineni <rtammineni(at)partner(dot)aligntech(dot)com>, Chris Mair <chris(at)1006(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Queries are taking way longer in 9.6 than 9.5
Date: 2017-01-19 07:28:40
Message-ID: bf32da61-da56-d400-9537-d3fc01bac07b@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-admin pgsql-general

On 01/19/2017 06:21 AM, Merlin Moncure wrote:
>
...
>
> yes. Either way, I would like to very much understand how server is
> preferring 3m cost plan to 2.6k cost plan or is otherwise unable to
> access the cheap plan.
>

Perhaps it doesn't even see the 2.6k cost - it may not generate the plan
for some reason, or it arrives to different estimates.

The OP was repeatedly asked for details of the configuration, I've even
sent a query for doing that a few days back. It's difficult to help when
such basic info is not provided, though.

It'd also be interesting to see the statistics for the tables involved,
so something like

SELECT * FROM pg_stats WHERE tablename IN (... tables ...)

and

SELECT relname, relpages, reltuples, relallvisible
FROM pg_class WHERE relame IN (... tables ...)

might shed some light on what the planner assumes about the data.

Of course, there are other things we might need to know. For example if
there are foreign keys between the tables, 9.6 is using that for the
estimates (unlike 9.5). And so on.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message PAWAN SHARMA 2017-01-19 11:58:44 Moving from 9.5 to 9.6
Previous Message Merlin Moncure 2017-01-19 05:21:20 Re: Queries are taking way longer in 9.6 than 9.5

Browse pgsql-admin by date

  From Date Subject
Next Message PAWAN SHARMA 2017-01-19 11:58:44 Moving from 9.5 to 9.6
Previous Message Merlin Moncure 2017-01-19 05:21:20 Re: Queries are taking way longer in 9.6 than 9.5

Browse pgsql-general by date

  From Date Subject
Next Message Julian Paul 2017-01-19 11:53:11 Can we not give tyrannical pedants control of #postgresql?
Previous Message Merlin Moncure 2017-01-19 05:21:20 Re: Queries are taking way longer in 9.6 than 9.5