> If that is the case, then how would using SnapshotAny solve this
> problem.  We get the value from index first and then check its
> visibility in heap, so if time is spent in _bt_checkkeys, why would
> using a different kind of Snapshot solve the problem?

1st scanning on the index with SnapshotAny will accept this rows and
will not mark this entries as killed. 

Theremore, killed entries are ignored on standby. And scanning with
SnapshotAny will always accept first row from index.
      * During recovery we ignore killed tuples and don't bother to kill them
      * either. We do this because the xmin on the primary node could easily be
      * later than the xmin on the standby node, so that what the primary
      * thinks is killed is supposed to be visible on standby. So for correct
      * MVCC for queries during recovery we must ignore these hints and check
      * all tuples. Do *not* set ignore_killed_tuples to true when running in a
      * transaction that was started during recovery. xactStartedInRecovery
      * should not be altered by index AMs.
     scan->kill_prior_tuple = false;
     scan->xactStartedInRecovery = TransactionStartedDuringRecovery();
     scan->ignore_killed_tuples = !scan->xactStartedInRecovery;

We execute this read-only queries on standby.

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to