Re: Slow planning time for simple query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Maksim Milyutin <milyutinma(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Slow planning time for simple query
Date: 2018-06-09 19:49:09
Message-ID: 9661.1528573749@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Maksim Milyutin <milyutinma(at)gmail(dot)com> writes:
> On hot standby I faced with the similar problem.
> ...
> is planned 4.940 ms on master and *254.741* ms on standby.

Presumably the problem is that the standby isn't authorized to change
the btree index's "entry is dead" bits, so it's unable to prune index
entries previously detected as dead, and thus the logic that intends
to improve this situation doesn't work on the standby.

(I wonder though why, if you executed the same query on the master,
its setting of the index-entry-is-dead bits didn't propagate to the
standby.)

I wonder if we should extend the "SnapshotNonVacuumable" logic introduced
in commit 3ca930fc3 so that in hot standby, *all* index entries are deemed
non vacuumable. This would essentially get rid of long standby planning
times in this sort of scenario by instead accepting worse (possibly much
worse) planner range estimates. I'm unsure if that's a good tradeoff or
not.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-06-09 19:52:26 Re: pg_upgrade and wraparound
Previous Message Adrian Klaver 2018-06-09 19:41:44 Re: pg_upgrade and wraparound

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2018-06-09 20:35:19 Re: Postgres 11 release notes
Previous Message Tom Lane 2018-06-09 19:18:15 Re: why partition pruning doesn't work?