From: Andres Freund Date: Wed, 24 Jan 2018 07:20:02 +0000 (-0800) Subject: WIP: Faster order. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=7648b52925d54f88e55d7969ed1f50be1cc3ea0d;p=users%2Fandresfreund%2Fpostgres.git WIP: Faster order. This breaks regression tests, but yields quite impressive speedups. --- diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index c08ab14c02..af4275461b 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