@@ -1663,6 +1663,15 @@ lazy_cleanup_index(Relation indrel,
1663
1663
* Don't even think about it unless we have a shot at releasing a goodly
1664
1664
* number of pages. Otherwise, the time taken isn't worth it.
1665
1665
*
1666
+ * Also don't attempt it if we are doing early pruning/vacuuming, because a
1667
+ * scan which cannot find a truncated heap page cannot determine that the
1668
+ * snapshot is too old to read that page. We might be able to get away with
1669
+ * truncating all except one of the pages, setting its LSN to (at least) the
1670
+ * maximum of the truncated range if we also treated an index leaf tuple
1671
+ * pointing to a missing heap page as something to trigger the "snapshot too
1672
+ * old" error, but that seems fragile and seems like it deserves its own patch
1673
+ * if we consider it.
1674
+ *
1666
1675
* This is split out so that we can test whether truncation is going to be
1667
1676
* called for before we actually do it. If you change the logic here, be
1668
1677
* careful to depend only on fields that lazy_scan_heap updates on-the-fly.