Re: [PROPOSAL] Use SnapshotAny in get_actual_variable_range

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Dmitriy Sarafannikov <dsarafannikov@yandex.ru>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Borodin Vladimir <root@simply.name>, Хомик Кирилл <khomikki@yandex-team.ru>
Date: 2017-04-27T21:27:38Z
Lists: pgsql-hackers
On 2017-04-27 17:22:25 -0400, Tom Lane wrote:
> > Yep, and I've seen that turn into a serious problem in production.
> 
> How so?  Shouldn't the indexscan go back and mark such tuples dead in
> the index, such that they'd be visited this way only once?  If that's
> not happening, maybe we should try to fix it.

One way that never happens is if you end up choosing bitmap index scans
all the time...  I've previously had to force a certain percentage of
queries with it disabled to keep indexes in a good state :(

- Andres


Commits

  1. Improve performance of get_actual_variable_range with recently-dead tuples.

  2. Use SnapshotDirty rather than an active snapshot to probe index endpoints.