From 60c085061f88c48acd5509a6f7757d4d111ba967 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 23 Jan 2018 23:20:02 -0800 Subject: [PATCH] WIP: Faster order. This breaks regression tests, but yields quite impressive speedups. --- src/backend/access/heap/heapam.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 8a846e7dba..d36c4826a4 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -421,9 +421,16 @@ heapgetpage(HeapScanDesc scan, BlockNumber page) */ all_visible = PageIsAllVisible(dp) && !snapshot->takenDuringRecovery; +//#define FASTORDER +#ifdef FASTORDER + for (lineoff = lines, lpp = PageGetItemId(dp, lineoff); + lineoff >= FirstOffsetNumber; + lineoff--, lpp--) +#else for (lineoff = FirstOffsetNumber, lpp = PageGetItemId(dp, lineoff); lineoff <= lines; lineoff++, lpp++) +#endif { if (ItemIdIsNormal(lpp)) { @@ -2089,8 +2096,9 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, /* * Shouldn't see a HEAP_ONLY tuple at chain start. */ - if (at_chain_start && HeapTupleIsHeapOnly(heapTuple)) - break; + Assert(!(at_chain_start && HeapTupleIsHeapOnly(heapTuple))); + //if (at_chain_start && HeapTupleIsHeapOnly(heapTuple)) + // break; /* * The xmin should match the previous xmax value, else chain is -- 2.39.5