Skip to content

chore: compile postgres statically to reduce the PLT function call #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gongxun0928
Copy link
Contributor

When building postgres, link all the *.o files directly into the binary instead of linking libpostgres.so.
This approach reduces the overhead of PLT function calls. Based on our internal performance tests,
this change improves the performance of a 1TB TPC-DS benchmark by 5-8%.

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@gongxun0928 gongxun0928 force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch from 8ff9d04 to 097d18c Compare April 27, 2025 07:31
@my-ship-it my-ship-it requested a review from gfphoenix78 April 28, 2025 05:18
@my-ship-it my-ship-it force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch from 097d18c to 42e6c83 Compare May 9, 2025 05:42
@avamingli avamingli force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch from 42e6c83 to e47a61a Compare May 12, 2025 06:49
@gongxun0928 gongxun0928 requested a review from gfphoenix78 May 12, 2025 16:19
@gongxun0928 gongxun0928 force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch from dc0a421 to f57317e Compare May 16, 2025 16:17
@gongxun0928 gongxun0928 force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch 2 times, most recently from 1df9a1d to 03b5cf8 Compare May 20, 2025 04:42
@gongxun0928 gongxun0928 requested a review from gfphoenix78 May 20, 2025 04:43
During TPC-DS testing, we observed that compiling postgres with
libpostgres.so introduces PTL function call overhead for some functions.
By linking object files (*.o) directly instead, we achieved a 5-8%
performance improvement in the TPC-DS 1TB benchmark.

This commit modifies the postgres linking process to directly link with
the object files rather than the shared library.

Additionally, this update fixes a minor bug: the pax extension has a
dependency on libpostgres.so. Now, when enabling the pax entension, we
check that enable_shared_postgres_backend is set to 'yes' to ensure
proper functionality.
@gongxun0928 gongxun0928 force-pushed the chore/build-postgres-in-static-and-build-libpostgres.so-for-other-extension-which-write-unittests branch from 03b5cf8 to e1244e6 Compare May 20, 2025 16:45
@tuhaihe
Copy link
Member

tuhaihe commented May 22, 2025

Can wait for #1081 to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants