pg_orca
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_orca | 1.0.0 | OLAP | Apache-2.0 | C++ |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2540 | pg_orca | No | Yes | Yes | Yes | No | No | - |
| Related | pg_hint_plan hypopg index_advisor online_advisor pg_qualstats pg_stat_plans plan_filter pg_track_optimizer pg_strom pg_regresql |
|---|
PG18 only; use session_preload_libraries=pg_orca for automatic planner hook loading.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.0 | 1817161514 | pg_orca | - |
| RPM | PIGSTY | 1.0.0 | 1817161514 | pg_orca_$v | - |
| DEB | PIGSTY | 1.0.0 | 1817161514 | postgresql-$v-pg-orca | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0.0 el8.x86_64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el8.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el8.aarch64 | PIGSTY 1.0.0 el8.aarch64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el8.aarch64.rpm
| N/A | N/A | N/A | N/A |
| el9.x86_64 | PIGSTY 1.0.0 el9.x86_64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el9.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el9.aarch64 | PIGSTY 1.0.0 el9.aarch64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el9.aarch64.rpm
| N/A | N/A | N/A | N/A |
| el10.x86_64 | PIGSTY 1.0.0 el10.x86_64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el10.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el10.aarch64 | PIGSTY 1.0.0 el10.aarch64.pg18 : pg_orca_18 pg_orca_18-1.0.0-1PIGSTY.el10.aarch64.rpm
| N/A | N/A | N/A | N/A |
| d12.x86_64 | PIGSTY 1.0.0 d12.x86_64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~bookworm_amd64.deb
| N/A | N/A | N/A | N/A |
| d12.aarch64 | PIGSTY 1.0.0 d12.aarch64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~bookworm_arm64.deb
| N/A | N/A | N/A | N/A |
| d13.x86_64 | PIGSTY 1.0.0 d13.x86_64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~trixie_amd64.deb
| N/A | N/A | N/A | N/A |
| d13.aarch64 | PIGSTY 1.0.0 d13.aarch64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~trixie_arm64.deb
| N/A | N/A | N/A | N/A |
| u22.x86_64 | PIGSTY 1.0.0 u22.x86_64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~jammy_amd64.deb
| N/A | N/A | N/A | N/A |
| u22.aarch64 | PIGSTY 1.0.0 u22.aarch64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~jammy_arm64.deb
| N/A | N/A | N/A | N/A |
| u24.x86_64 | PIGSTY 1.0.0 u24.x86_64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~noble_amd64.deb
| N/A | N/A | N/A | N/A |
| u24.aarch64 | PIGSTY 1.0.0 u24.aarch64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~noble_arm64.deb
| N/A | N/A | N/A | N/A |
| u26.x86_64 | PIGSTY 1.0.0 u26.x86_64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~resolute_amd64.deb
| N/A | N/A | N/A | N/A |
| u26.aarch64 | PIGSTY 1.0.0 u26.aarch64.pg18 : postgresql-18-pg-orca postgresql-18-pg-orca_1.0.0-1PIGSTY~resolute_arm64.deb
| N/A | N/A | N/A | N/A |
Build
You can build the RPM / DEB packages for pg_orca using pig build:
Install
You can install pg_orca directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources: pgorca README, entrypoint/GUC source, control file.
pg_orca plugs the ORCA cost-based optimizer from the Greenplum/Apache Cloudberry lineage into a standard PostgreSQL 18 server. The upstream README describes this project as PostgreSQL 18-only, and the local package metadata also marks it for PG18 only.
Enable ORCA For A Session
CREATE EXTENSION loads the library in the current session, so the pg_orca.* GUCs and planner hook are available immediately:
If ORCA cannot handle a query, the README says it falls back to the standard PostgreSQL planner automatically. Turn on fallback logging while validating a workload:
Preload For New Connections
For automatic planner-hook loading in later sessions, upstream recommends session_preload_libraries, not shared_preload_libraries:
Existing sessions are unaffected until they reconnect. If another session preload library is already configured, include both values explicitly:
Role-local and cluster-wide scopes are also valid:
Tuning And Diagnostics
The README documents these main GUCs:
pg_orca.enable_orca: enable ORCA; defaultoff.pg_orca.trace_fallback: log fallback to the standard planner; defaultoff.optimizer_segments: segment count for costing; default1.optimizer_sort_factor: sort cost scaling; default1.0.optimizer_metadata_caching: cache relation metadata; defaulton.optimizer_mdcache_size: metadata cache size in KB; default16384.optimizer_search_strategy_path: optional custom search strategy XML path.
The entrypoint source also defines additional ORCA tuning and debug GUCs such as optimizer_join_order, pg_orca.join_order_dynamic_threshold, pg_orca.cost_model, and optimizer_print_*. Treat those as workload/debug knobs and validate plans before keeping them in a persistent database setting.
Caveats
- PostgreSQL 18 only.
- Use
session_preload_libraries = 'pg_orca'for automatic loading in new sessions. - ORCA is disabled by default after loading; set
pg_orca.enable_orca = on. - Fallback to the PostgreSQL planner is expected for unsupported queries; enable
pg_orca.trace_fallbackwhen checking coverage.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)