pg18 patch: separate package for llvm/jit - Mailing list pgsql-pkg-debian

From Jeremy Schneider
Subject pg18 patch: separate package for llvm/jit
Date
Msg-id 20250224134829.286cc256@ardentperf.com
Whole thread Raw
List pgsql-pkg-debian
Hello Debian hackers,

Last month I asked if we could make LLVM/JIT a choice for installation,
similar to procedural languages like perl, python and tcl. [1] Today it
is part of the main postgresql package.

I would like to propose this change for Postgres 18.

Our motivation is that LLVM/JIT alone increases the total size of the
docker image by 67% (not that far from doubling it), and with many
installations and frequent deployments and updates across a large
fleet, this space savings will be worthwhile when LLVM/JIT is not
needed.

After last month's discussion, in a short thread on the hackers list, I
learned that Postgres explicitly supports building with LLVM/JIT
support and running without the library files, which enables separating
LLVM/JIT into a separate package. [2]

I also learned that the PGDG rpm packagers have already been using this
approach for some time. [3]

Attached are a few patches for debian packaging which I used to
initially test the same pattern as rpm packaging. There are a few small
outstanding items before they are commit-ready, but this enabled me to
confirm that the approach works with debian's build system. Not only
did it successfully remove the LLVM/JIT dependency from the main
package and attach it to the separate package, but it even reduced the
Installed-Size from 57726kb down to 34335kb (which I did not expect).
Those bitcode files are a lot bigger than I realized.

I named the new package postgresql-17-jit-llvm to align with the
current "provides" naming

A few outstanding items to make these commit-ready:
1. Update the provides/requires for postgresql and jit-llvm (postgresql
should still recommend LLVM/JIT)
2. Figure out what happens with this new package on architectures that
don't support LLVM/JIT (empty package? README explanation?)
3. Make sure the bitcode directory itself is created by the main
package so that extensions can use the directory
4. Remove the perl, python and tcl bitcode files from the llvm package
(they are included in the PL packages)

Note that patches are needed against both postgresql-common and
postgresql repositories on salsa (hence two attachments)

Thanks
-Jeremy


1: https://postgr.es/m/20250109005301.3b145092%40jeremy-ThinkPad-T430s
2: https://postgr.es/m/20250111183709.4691fd17%40ardentperf.com
3:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-17/main/postgresql-17.spec;h=30ab4b0496a7c7165318dc7da05f76dc8b437a97;hb=HEAD#l1190



===== without patches:

dpkg -I ../pg17/postgresql-17_17.4-1_amd64.deb
 new Debian package, version 2.0.
 size 17867268 bytes: control archive=41861 bytes.
    1524 bytes,    23 lines      control
  146703 bytes,  1571 lines      md5sums
     190 bytes,    13 lines   *  postinst             #!/bin/sh
    2642 bytes,    86 lines   *  postrm               #!/bin/sh
     349 bytes,    18 lines   *  preinst              #!/bin/sh
     199 bytes,    16 lines   *  prerm                #!/bin/sh
    4554 bytes,    29 lines      templates
 Package: postgresql-17
 Version: 17.4-1
 Architecture: amd64
 Maintainer: Debian PostgreSQL Maintainers
<team+postgresql@tracker.debian.org> Installed-Size: 57726
 Depends: locales | locales-all, postgresql-client-17,
postgresql-common (>= 252~), ssl-cert, tzdata, debconf (>= 0.5) |
debconf-2.0, libc6 (>= 2.38), libgcc-s1 (>= 3.3.1), libgssapi-krb5-2
(>= 1.14+dfsg), libicu74 (>= 74.1-1~), libldap2 (>= 2.6.2), libllvm19,
liblz4-1 (>= 0.0~r130), libpam0g (>= 0.99.7.1), libpq5 (>= 17~~),
libselinux1 (>= 3.1~), libssl3t64 (>= 3.0.0), libstdc++6 (>= 5.2),
libsystemd0, libuuid1 (>= 2.16), libxml2 (>= 2.7.4), libxslt1.1 (>=
1.1.25), libzstd1 (>= 1.5.5), zlib1g (>= 1:1.1.4) Recommends: sysstat
Breaks: dbconfig-common (<< 2.0.22~) Provides: postgresql-17-jit-llvm
(= 19), postgresql-contrib-17 Section: database Priority: optional
Homepage: http://www.postgresql.org/ Description: The World's Most
Advanced Open Source Relational Database PostgreSQL, also known as
Postgres, is a free and open-source relational database management
system (RDBMS) emphasizing extensibility and SQL compliance. It
features transactions with Atomicity, Consistency, Isolation,
Durability (ACID) properties, automatically updatable views,
materialized views, triggers, foreign keys, and stored procedures. It
is designed to handle a range of workloads, from single machines to
data warehouses or Web services with many concurrent users. . This
package provides the database server for PostgreSQL 17.
Postgresql-Catversion: 202406281-1700



===== with patches:

dpkg -I postgresql-17_17.4-1_amd64.deb
 new Debian package, version 2.0.
 size 7875442 bytes: control archive=18570 bytes.
    1470 bytes,    23 lines      control
   50801 bytes,   602 lines      md5sums
     190 bytes,    13 lines   *  postinst             #!/bin/sh
    2642 bytes,    86 lines   *  postrm               #!/bin/sh
     349 bytes,    18 lines   *  preinst              #!/bin/sh
     199 bytes,    16 lines   *  prerm                #!/bin/sh
    4554 bytes,    29 lines      templates
 Package: postgresql-17
 Version: 17.4-1
 Architecture: amd64
 Maintainer: Debian PostgreSQL Maintainers
<team+postgresql@tracker.debian.org> Installed-Size: 34335
 Depends: locales | locales-all, postgresql-client-17,
postgresql-common (>= 252~), ssl-cert, tzdata, debconf (>= 0.5) |
debconf-2.0, libc6 (>= 2.38), libgssapi-krb5-2 (>= 1.14+dfsg), libicu74
(>= 74.1-1~), libldap2 (>= 2.6.2), liblz4-1 (>= 0.0~r130), libpam0g (>=
0.99.7.1), libpq5 (>= 17~~), libselinux1 (>= 3.1~), libssl3t64 (>=
3.0.0), libsystemd0, libuuid1 (>= 2.16), libxml2 (>= 2.7.4), libxslt1.1
(>= 1.1.25), libzstd1 (>= 1.5.5), zlib1g (>= 1:1.1.4) Recommends:
sysstat Breaks: dbconfig-common (<< 2.0.22~) Provides:
postgresql-17-jit-llvm (= 19), postgresql-contrib-17 Section: database
Priority: optional Homepage: http://www.postgresql.org/ Description:
The World's Most Advanced Open Source Relational Database PostgreSQL,
also known as Postgres, is a free and open-source relational database
management system (RDBMS) emphasizing extensibility and SQL compliance.
It features transactions with Atomicity, Consistency, Isolation,
Durability (ACID) properties, automatically updatable views,
materialized views, triggers, foreign keys, and stored procedures. It
is designed to handle a range of workloads, from single machines to
data warehouses or Web services with many concurrent users. . This
package provides the database server for PostgreSQL 17.
Postgresql-Catversion: 202406281-1700


Attachment

pgsql-pkg-debian by date:

Previous
From: Christoph Berg
Date:
Subject: Re: Change in behavior when installing an additional PostgreSQL major version
Next
From: apt.postgresql.org Repository Update
Date:
Subject: pgagent updated to version 4.2.3-2.pgdg+1