diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index db811056991..6307ff0aede 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -341,6 +341,13 @@ index_beginscan_internal(Relation indexRelation, Relation heapRelation, scan->xs_snapshot = snapshot; scan->instrument = instrument; + /* + * A scan with SnapshotAny must also return dead rows that have not been + * pruned yet, so it cannot skip index entries marked LP_DEAD. + */ + if (snapshot == SnapshotAny) + scan->ignore_killed_tuples = false; + /* * Initialize heap-side scan state when a heap relation is provided. * Bitmap index scans don't provide one.