WIP: Faster order. jit-before-rebase-2018-02-06
authorAndres Freund <andres@anarazel.de>
Wed, 24 Jan 2018 07:20:02 +0000 (23:20 -0800)
committerAndres Freund <andres@anarazel.de>
Mon, 5 Feb 2018 16:00:11 +0000 (08:00 -0800)
This breaks regression tests, but yields quite impressive speedups.

src/backend/access/heap/heapam.c

index 8a846e7dbaa9e38373f3f5d3af5e1c3fdc386db2..d36c4826a4477c84d07533cc3f53defbecd3b42c 100644 (file)
@@ -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