pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true
2+ messages / 1 participants
[nested] [flat]

* pgsql: Grab the low-hanging fruit from forcing sizeof(Datum) to 8.
@ 2025-08-13 21:18 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-08-13 21:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Grab the low-hanging fruit from forcing sizeof(Datum) to 8.

Remove conditionally-compiled code for smaller Datum widths,
and simplify comments that describe cases no longer of interest.

I also fixed up a few more places that were not using
DatumGetIntXX where they should, and made some cosmetic
adjustments such as using sizeof(int64) not sizeof(Datum)
in places where that fit better with the surrounding code.

One thing I remembered while preparing this part is that SP-GiST
stores pass-by-value prefix keys as Datums, so that the on-disk
representation depends on sizeof(Datum).  That's even more
unfortunate than the existing commentary makes it out to be,
because now there is a hazard that the change of sizeof(Datum)
will break SP-GiST indexes on 32-bit machines.  It appears that
there are no existing SP-GiST opclasses that are actually
affected; and if there are some that I didn't find, the number
of installations that are using them on 32-bit machines is
doubtless tiny.  So I'm proceeding on the assumption that we
can get away with this, but it's something to worry about.

(gininsert.c looks like it has a similar problem, but it's okay
because the "tuples" it's constructing are just transient data
within the tuplesort step.  That's pretty poorly documented
though, so I added some comments.)

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6aebedc38497ecebda22caf61bcadf78a8331b52

Modified Files
--------------
doc/src/sgml/xfunc.sgml                |   3 +-
src/backend/access/gin/gininsert.c     |   5 +-
src/backend/access/gist/gistproc.c     |  10 +--
src/backend/access/nbtree/nbtcompare.c |  20 ------
src/backend/catalog/pg_type.c          |   4 +-
src/backend/utils/adt/mac.c            |  27 +++-----
src/backend/utils/adt/network.c        |  54 ++++-----------
src/backend/utils/adt/numeric.c        | 117 ++++-----------------------------
src/backend/utils/adt/timestamp.c      |  21 ------
src/backend/utils/adt/uuid.c           |   6 +-
src/backend/utils/adt/varlena.c        |  27 +++-----
src/backend/utils/sort/tuplesort.c     |   8 ---
src/include/access/gin_tuple.h         |   4 +-
src/include/access/spgist_private.h    |  14 ++--
src/include/access/tupmacs.h           |  15 ++---
src/include/port/pg_bswap.h            |  17 +----
src/include/utils/sortsupport.h        |   4 --
17 files changed, 72 insertions(+), 284 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true
@ 2025-08-13 21:18 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-08-13 21:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true.

Remove conditionally-compiled code for the other case.

Replace uses of FLOAT8PASSBYVAL with constant "true", mainly because
it was quite confusing in cases where the type we were dealing with
wasn't float8.

I left the associated pg_control and Pg_magic_struct fields in place.
Perhaps we should get rid of them, but it would save little, so it
doesn't seem worth thinking hard about the compatibility implications.
I just labeled them "vestigial" in places where that seemed helpful.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ee54046601de2d14ca9107ba04c50178d9b52fe6

Modified Files
--------------
contrib/btree_gist/btree_time.c               | 51 ++++++++----------
contrib/btree_gist/btree_ts.c                 | 39 ++++++--------
src/backend/access/common/tupdesc.c           |  2 +-
src/backend/access/index/indexam.c            |  5 --
src/backend/access/transam/xlog.c             | 20 +------
src/backend/catalog/genbki.pl                 |  3 +-
src/backend/optimizer/plan/planagg.c          |  2 +-
src/backend/optimizer/plan/planner.c          |  4 +-
src/backend/parser/parse_node.c               |  2 +-
src/backend/rewrite/rewriteSearchCycle.c      |  2 +-
src/backend/utils/adt/arrayfuncs.c            |  6 +--
src/backend/utils/adt/int8.c                  | 75 +++++----------------------
src/backend/utils/adt/numeric.c               | 74 ++++++--------------------
src/backend/utils/adt/orderedsetaggs.c        |  2 +-
src/backend/utils/adt/rangetypes_typanalyze.c |  2 +-
src/backend/utils/fmgr/fmgr.c                 | 35 -------------
src/bin/initdb/initdb.c                       |  3 --
src/bin/pg_resetwal/pg_resetwal.c             |  2 +-
src/include/c.h                               |  8 +--
src/include/catalog/pg_type.dat               | 16 +++---
src/include/fmgr.h                            |  2 +-
src/include/postgres.h                        | 58 ++-------------------
22 files changed, 100 insertions(+), 313 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-08-13 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-13 21:18 pgsql: Grab the low-hanging fruit from forcing sizeof(Datum) to 8. Tom Lane <tgl@sss.pgh.pa.us>
2025-08-13 21:18 pgsql: Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox