Re: [HACKERS] [PROPOSAL] Use SnapshotAny in get_actual_variable_range - Mailing list pgsql-hackers

From Dmitriy Sarafannikov
Subject Re: [HACKERS] [PROPOSAL] Use SnapshotAny in get_actual_variable_range
Date
Msg-id 7E4A7933-9921-47E0-BF45-DFB55747A858@yandex.ru
Whole thread Raw
In response to Re: [HACKERS] [PROPOSAL] Use SnapshotAny in get_actual_variable_range  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
> 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
botherto kill them     * either. We do this because the xmin on the primary node could easily be     * later than the
xminon 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_tuplesto 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.


pgsql-hackers by date:

Previous
From: Beena Emerson
Date:
Subject: Re: [HACKERS] multi-column range partition constraint
Next
From: Mahi Gurram
Date:
Subject: [HACKERS] Regarding B-Tree Lookup