]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Always inline SeqNext and SeqRecheck
authorDavid Rowley <drowley@postgresql.org>
Mon, 26 Jan 2026 01:29:10 +0000 (14:29 +1300)
committerDavid Rowley <drowley@postgresql.org>
Mon, 26 Jan 2026 01:29:10 +0000 (14:29 +1300)
The intention of the work done in fb9f95502 was that these functions are
inlined.  I noticed my compiler isn't doing this on -O2 (gcc version
15.2.0).  Also, clang version 20.1.8 isn't inlining either.  Fix by
marking both of these functions as pg_attribute_always_inline to avoid
leaving this up to the compiler's heuristics.

A quick test with a Seq Scan on a table with a single int column running
a query that filters all 1 million rows in the WHERE clause yields a
3.9% speedup on my Zen4 machine.

Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvrL7Q41B=gv+3wc8+AJGKZugGegUbBo8FPQ+3+NGTPb+w@mail.gmail.com

src/backend/executor/nodeSeqscan.c

index b8119face438fc205c470aebf317b09b82fd9e50..af3c788ce8b8619a49d8823eb9451d229dfb52ba 100644 (file)
@@ -47,7 +47,7 @@ static TupleTableSlot *SeqNext(SeqScanState *node);
  *             This is a workhorse for ExecSeqScan
  * ----------------------------------------------------------------
  */
-static TupleTableSlot *
+static pg_attribute_always_inline TupleTableSlot *
 SeqNext(SeqScanState *node)
 {
        TableScanDesc scandesc;
@@ -86,7 +86,7 @@ SeqNext(SeqScanState *node)
 /*
  * SeqRecheck -- access method routine to recheck a tuple in EvalPlanQual
  */
-static bool
+static pg_attribute_always_inline bool
 SeqRecheck(SeqScanState *node, TupleTableSlot *slot)
 {
        /*