Repository navigation
perf(nix): shrink postgres-env closure - #2521
Conversation
ef2f02c to
788a49a
Compare
This comment has been minimized.
This comment has been minimized.
Strip pgrx extension .so files fully. The stdenv fixup only strips debug sections and leaves .symtab behind. Split postgres-env-* into a runtime env and postgres-env-*-debug, which carries postgresql_*_src and debug symbols. Drop supautils from the base psql_* extension set. The site profile loads it through dynamic_library_path, so install site-env on the AMI, add pg-extensions to site-env, and set dynamic_library_path. Add psql_*_latest, which ships only the latest version of each extension, and use it in postgres-env-*. Split slim from latestOnly so the base env keeps systemd support and the regular locales. Link postgres against systemdLibs instead of the full systemd. Use the main curl in pg_net, which removes a second glibc. Build sfcgal and cgal against boost with icu75, which removes a second ICU. postgres-env-17 closure on aarch64-linux: 2.54 GB to 1.00 GB. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ce95a93 to
d3f77d3
Compare
Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Versions before 0.20.4 include curl/multi.h directly. With curl 8.17 the typecheck macro for curl_multi_setopt breaks the declaration in multi.h. Define CURL_DISABLE_TYPECHECK for those versions. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PostgreSQL Extension Dependency Analysis: PR #2521
SummaryThe following extensions have dependencies that underwent MAJOR version updates:
Full Analysis ResultsPostgreSQL 15 Extension DependenciesExtension: pg_net
Raw Dependency TreeExtension: pg_repack
Raw Dependency TreeExtension: postgis
Raw Dependency TreePostgreSQL 17 Extension DependenciesExtension: pg_net
Raw Dependency TreeExtension: pg_repack
Raw Dependency TreeExtension: postgis
Raw Dependency Tree |
PostgreSQL Package Dependency Analysis: PR #2521
SummaryThe following packages underwent MAJOR version updates:
Full Analysis ResultsPostgreSQL 15 Dependency ChangesExtracting PostgreSQL 15 dependencies...
Runtime Closure Size
Raw Dependency ClosurePostgreSQL 17 Dependency ChangesExtracting PostgreSQL 17 dependencies...
Runtime Closure Size
Raw Dependency Closure |
This comment has been minimized.
This comment has been minimized.
Drop psql_*_latest and the slim split. Add psql_*_env, the base extension set without supautils, and build postgres-env-* from it. Supautils stays in the base psql_* for tests and docker images. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Keep supautils in the base extension set and leave site-env and the ansible config as on develop, so this change stands alone. Use the smaller pg_net compile flag change. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move the debug env split out to its own change. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Build libunistring, libidn2, and libpsl against apple libiconv for the pg_net curl on darwin, so the cli bundle has a single libiconv.2.dylib. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
pgbouncer only needs sd_notify from libsystemd. The full systemd pulled in kbd, p11-kit, elfutils, tpm2-tss, gnutls, and cryptsetup as well. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move the pgrx strip to the debug env change. Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Package version diffCompares built package versions in legacyPackages between this PR and the tip of the base branch, per system. aarch64-linux: Closure size: 73 -> 73 (2 paths added, 2 paths removed, delta +0, disk usage +0B).x86_64-linux: Closure size: 74 -> 74 (2 paths added, 2 paths removed, delta +0, disk usage +0B). |
| }; | ||
| in | ||
| _final: _prev: { | ||
| curl_8_6 = oldstable.curl; |
There was a problem hiding this comment.
is dropping this safe? what tests cover it?
There was a problem hiding this comment.
looks like its handled by the export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DCURL_DISABLE_TYPECHECK" in pg_net
There was a problem hiding this comment.
Safe. Only pg_net used curl_8_6, and it now builds against the main curl. Old versions get -DCURL_DISABLE_TYPECHECK for the curl 8.17 header break, as @mmlb noted. Every pg_net version builds for 15 and 17, and the pg_net tests run in the check harness.
…es-17-env-closure-size-eb81a5 # Conflicts: # nix/ext/postgis.nix
| }; | ||
| in | ||
| _final: _prev: { | ||
| curl_8_6 = oldstable.curl; |
There was a problem hiding this comment.
looks like its handled by the export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DCURL_DISABLE_TYPECHECK" in pg_net
Refs: MPG-1325 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Why?
The
postgres-env-*closures are 2.5 to 2.9 GB. Duplicate libraries and the full systemd are in them.Summary
systemdbuild input of postgres withsystemdLibs. Postgres only needslibsystemd.systemdbuild input ofpgbouncerwithsystemdLibs. It only needssd_notify, and the full package pulled inkbd,p11-kit,elfutils,tpm2-tss,gnutls, andcryptsetup.curl_8_6inpg_netwith the maincurl, and drop thecurl_8_6overlay. This avoids a second curl and a second glibc.-DCURL_DISABLE_TYPECHECKtopg_netversions before 0.20.4. This fixes a build error with curl 8.17, where the typecheck macros breakcurl/multi.h.libiconvwith Applelibiconvin the darwincurlofpg_net. This fixes the_libiconvload error in the CLI bundle, which had two differentlibiconv.2.dylibfiles.boostinsfcgalandcgalwith one built againsticu75. This avoids a second ICU, 76.1 next to the 75.1 postgres uses.Result
Closure on aarch64-linux, from
nix path-info -S. AMI rows are the root disk usage from thereport-disk-usagejob.postgres-env-15postgres-env-17postgres-env-orioledb-17psql_15/binpsql_17/binpsql_orioledb-17/binpsql_15_slim/binpsql_17_slim/binpsql_orioledb-17_slim/binpsql_17_cli/binFollowup
Potential savings: 1 GB.
Test plan
postgres-env-{15,17,orioledb-17}buildpg_netversions build for 15 and 17MPG-1325