pg_hint_plan

pg_hint_plan

pg_hint_plan : Give PostgreSQL ability to manually force some decisions in execution plans.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2780
pg_hint_plan
pg_hint_plan
1.8.0
FEAT
BSD 3-Clause
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemashint_plan
See Also
pg_show_plans
pg_store_plans
pg_stat_statements
hypopg
pg_qualstats
auto_explain
index_advisor
pg_profile

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PGDG
1.8.0
18
17
16
15
14
pg_hint_plan-
RPM
PGDG
1.8.0
18
17
16
15
14
pg_hint_plan_$v-
DEB
PGDG
1.8.0
18
17
16
15
14
postgresql-$v-pg-hint-plan-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
el8.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
el9.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
el9.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
el10.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
el10.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
d12.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
d12.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
d13.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
d13.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
u22.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
u22.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
u24.x86_64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
u24.aarch64
PGDG 1.8.0
PGDG 1.7.1
PGDG 1.6.2
PGDG 1.5.3
PGDG 1.4.4
PackageVersionOSORGSIZEFile URL
pg_hint_plan_181.8.0el8.x86_64pgdg55.3 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_181.8.0el8.aarch64pgdg51.7 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_181.8.0el9.x86_64pgdg54.4 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_181.8.0el9.aarch64pgdg52.5 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_181.8.0el10.x86_64pgdg55.5 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel10.x86_64.rpm
pg_hint_plan_181.8.0el10.aarch64pgdg53.7 KiBpg_hint_plan_18-1.8.0-1PGDG.rhel10.aarch64.rpm
postgresql-18-pg-hint-plan1.8.0d12.x86_64pgdg132.8 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg12+1_amd64.deb
postgresql-18-pg-hint-plan1.8.0d12.aarch64pgdg128.8 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg12+1_arm64.deb
postgresql-18-pg-hint-plan1.8.0d13.x86_64pgdg133.2 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg13+1_amd64.deb
postgresql-18-pg-hint-plan1.8.0d13.aarch64pgdg128.8 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg13+1_arm64.deb
postgresql-18-pg-hint-plan1.8.0u22.x86_64pgdg133.8 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg22.04+1_amd64.deb
postgresql-18-pg-hint-plan1.8.0u22.aarch64pgdg129.8 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg22.04+1_arm64.deb
postgresql-18-pg-hint-plan1.8.0u24.x86_64pgdg131.7 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg24.04+1_amd64.deb
postgresql-18-pg-hint-plan1.8.0u24.aarch64pgdg128.0 KiBpostgresql-18-pg-hint-plan_1.8.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_hint_plan_171.7.1el8.x86_64pgdg53.2 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_171.7.0el8.x86_64pgdg51.4 KiBpg_hint_plan_17-1.7.0-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_171.7.1el8.aarch64pgdg50.0 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_171.7.0el8.aarch64pgdg48.2 KiBpg_hint_plan_17-1.7.0-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_171.7.1el9.x86_64pgdg52.6 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_171.7.0el9.x86_64pgdg50.7 KiBpg_hint_plan_17-1.7.0-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_171.7.1el9.aarch64pgdg50.6 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_171.7.0el9.aarch64pgdg49.0 KiBpg_hint_plan_17-1.7.0-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_171.7.1el10.x86_64pgdg53.6 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel10.x86_64.rpm
pg_hint_plan_171.7.0el10.x86_64pgdg52.0 KiBpg_hint_plan_17-1.7.0-3PGDG.rhel10.x86_64.rpm
pg_hint_plan_171.7.1el10.aarch64pgdg52.1 KiBpg_hint_plan_17-1.7.1-1PGDG.rhel10.aarch64.rpm
pg_hint_plan_171.7.0el10.aarch64pgdg50.4 KiBpg_hint_plan_17-1.7.0-3PGDG.rhel10.aarch64.rpm
postgresql-17-pg-hint-plan1.7.1d12.x86_64pgdg128.0 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg12+1_amd64.deb
postgresql-17-pg-hint-plan1.7.1d12.aarch64pgdg123.9 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg12+1_arm64.deb
postgresql-17-pg-hint-plan1.7.1d13.x86_64pgdg128.4 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg13+1_amd64.deb
postgresql-17-pg-hint-plan1.7.1d13.aarch64pgdg124.3 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg13+1_arm64.deb
postgresql-17-pg-hint-plan1.7.1u22.x86_64pgdg140.9 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg22.04+1_amd64.deb
postgresql-17-pg-hint-plan1.7.1u22.aarch64pgdg137.2 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg22.04+1_arm64.deb
postgresql-17-pg-hint-plan1.7.1u24.x86_64pgdg126.7 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg24.04+1_amd64.deb
postgresql-17-pg-hint-plan1.7.1u24.aarch64pgdg123.4 KiBpostgresql-17-pg-hint-plan_1.7.1-1.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_hint_plan_161.6.2el8.x86_64pgdg45.8 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_161.6.1el8.x86_64pgdg44.2 KiBpg_hint_plan_16-1.6.1-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_161.6.0el8.x86_64pgdg42.6 KiBpg_hint_plan_16-1.6.0-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_161.6.2el8.aarch64pgdg43.4 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_161.6.1el8.aarch64pgdg41.8 KiBpg_hint_plan_16-1.6.1-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_161.6.0el8.aarch64pgdg40.2 KiBpg_hint_plan_16-1.6.0-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_161.6.2el9.x86_64pgdg46.5 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_161.6.1el9.x86_64pgdg44.9 KiBpg_hint_plan_16-1.6.1-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_161.6.0el9.x86_64pgdg43.2 KiBpg_hint_plan_16-1.6.0-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_161.6.2el9.aarch64pgdg45.0 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_161.6.1el9.aarch64pgdg43.5 KiBpg_hint_plan_16-1.6.1-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_161.6.0el9.aarch64pgdg41.6 KiBpg_hint_plan_16-1.6.0-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_161.6.2el10.x86_64pgdg47.7 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel10.x86_64.rpm
pg_hint_plan_161.6.1el10.x86_64pgdg46.2 KiBpg_hint_plan_16-1.6.1-3PGDG.rhel10.x86_64.rpm
pg_hint_plan_161.6.2el10.aarch64pgdg46.0 KiBpg_hint_plan_16-1.6.2-1PGDG.rhel10.aarch64.rpm
pg_hint_plan_161.6.1el10.aarch64pgdg44.5 KiBpg_hint_plan_16-1.6.1-3PGDG.rhel10.aarch64.rpm
postgresql-16-pg-hint-plan1.6.2d12.x86_64pgdg104.6 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg12+1_amd64.deb
postgresql-16-pg-hint-plan1.6.2d12.aarch64pgdg101.6 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg12+1_arm64.deb
postgresql-16-pg-hint-plan1.6.2d13.x86_64pgdg104.8 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg13+1_amd64.deb
postgresql-16-pg-hint-plan1.6.2d13.aarch64pgdg101.9 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg13+1_arm64.deb
postgresql-16-pg-hint-plan1.6.2u22.x86_64pgdg117.2 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg22.04+1_amd64.deb
postgresql-16-pg-hint-plan1.6.2u22.aarch64pgdg114.4 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg22.04+1_arm64.deb
postgresql-16-pg-hint-plan1.6.2u24.x86_64pgdg104.4 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg24.04+1_amd64.deb
postgresql-16-pg-hint-plan1.6.2u24.aarch64pgdg101.7 KiBpostgresql-16-pg-hint-plan_1.6.2-1.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_hint_plan_151.5.3el8.x86_64pgdg45.3 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_151.5.2el8.x86_64pgdg43.7 KiBpg_hint_plan_15-1.5.2-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_151.5.1el8.x86_64pgdg48.9 KiBpg_hint_plan_15-1.5.1-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_151.5.3el8.aarch64pgdg43.0 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_151.5.2el8.aarch64pgdg41.5 KiBpg_hint_plan_15-1.5.2-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_151.5.1el8.aarch64pgdg46.6 KiBpg_hint_plan_15-1.5.1-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_151.5.3el9.x86_64pgdg46.0 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_151.5.2el9.x86_64pgdg44.7 KiBpg_hint_plan_15-1.5.2-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_151.5.1el9.x86_64pgdg49.4 KiBpg_hint_plan_15-1.5.1-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_151.5.3el9.aarch64pgdg44.5 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_151.5.2el9.aarch64pgdg43.1 KiBpg_hint_plan_15-1.5.2-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_151.5.1el9.aarch64pgdg47.8 KiBpg_hint_plan_15-1.5.1-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_151.5.3el10.x86_64pgdg47.4 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel10.x86_64.rpm
pg_hint_plan_151.5.2el10.x86_64pgdg46.2 KiBpg_hint_plan_15-1.5.2-3PGDG.rhel10.x86_64.rpm
pg_hint_plan_151.5.3el10.aarch64pgdg45.5 KiBpg_hint_plan_15-1.5.3-1PGDG.rhel10.aarch64.rpm
pg_hint_plan_151.5.2el10.aarch64pgdg44.2 KiBpg_hint_plan_15-1.5.2-3PGDG.rhel10.aarch64.rpm
postgresql-15-pg-hint-plan1.5.3d12.x86_64pgdg104.4 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg12+1_amd64.deb
postgresql-15-pg-hint-plan1.5.3d12.aarch64pgdg101.2 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg12+1_arm64.deb
postgresql-15-pg-hint-plan1.5.3d13.x86_64pgdg104.8 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg13+1_amd64.deb
postgresql-15-pg-hint-plan1.5.3d13.aarch64pgdg101.7 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg13+1_arm64.deb
postgresql-15-pg-hint-plan1.5.3u22.x86_64pgdg117.1 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg22.04+1_amd64.deb
postgresql-15-pg-hint-plan1.5.3u22.aarch64pgdg114.0 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg22.04+1_arm64.deb
postgresql-15-pg-hint-plan1.5.3u24.x86_64pgdg104.4 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg24.04+1_amd64.deb
postgresql-15-pg-hint-plan1.5.3u24.aarch64pgdg101.4 KiBpostgresql-15-pg-hint-plan_1.5.3-1.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_hint_plan_141.4.4el8.x86_64pgdg44.6 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_141.4.3el8.x86_64pgdg43.3 KiBpg_hint_plan_14-1.4.3-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_141.4.2el8.x86_64pgdg42.0 KiBpg_hint_plan_14-1.4.2-1PGDG.rhel8.x86_64.rpm
pg_hint_plan_141.4.4el8.aarch64pgdg42.3 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_141.4.3el8.aarch64pgdg41.0 KiBpg_hint_plan_14-1.4.3-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_141.4.2el8.aarch64pgdg39.7 KiBpg_hint_plan_14-1.4.2-1PGDG.rhel8.aarch64.rpm
pg_hint_plan_141.4.4el9.x86_64pgdg45.4 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_141.4.3el9.x86_64pgdg44.2 KiBpg_hint_plan_14-1.4.3-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_141.4.2el9.x86_64pgdg42.8 KiBpg_hint_plan_14-1.4.2-1PGDG.rhel9.x86_64.rpm
pg_hint_plan_141.4.4el9.aarch64pgdg43.9 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_141.4.3el9.aarch64pgdg42.7 KiBpg_hint_plan_14-1.4.3-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_141.4.2el9.aarch64pgdg41.2 KiBpg_hint_plan_14-1.4.2-1PGDG.rhel9.aarch64.rpm
pg_hint_plan_141.4.4el10.x86_64pgdg46.8 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel10.x86_64.rpm
pg_hint_plan_141.4.3el10.x86_64pgdg45.6 KiBpg_hint_plan_14-1.4.3-3PGDG.rhel10.x86_64.rpm
pg_hint_plan_141.4.4el10.aarch64pgdg44.9 KiBpg_hint_plan_14-1.4.4-1PGDG.rhel10.aarch64.rpm
pg_hint_plan_141.4.3el10.aarch64pgdg43.7 KiBpg_hint_plan_14-1.4.3-3PGDG.rhel10.aarch64.rpm
postgresql-14-pg-hint-plan1.4.4d12.x86_64pgdg104.1 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg12+1_amd64.deb
postgresql-14-pg-hint-plan1.4.4d12.aarch64pgdg100.8 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg12+1_arm64.deb
postgresql-14-pg-hint-plan1.4.4d13.x86_64pgdg104.5 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg13+1_amd64.deb
postgresql-14-pg-hint-plan1.4.4d13.aarch64pgdg101.1 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg13+1_arm64.deb
postgresql-14-pg-hint-plan1.4.4u22.x86_64pgdg116.6 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg22.04+1_amd64.deb
postgresql-14-pg-hint-plan1.4.4u22.aarch64pgdg113.5 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg22.04+1_arm64.deb
postgresql-14-pg-hint-plan1.4.4u24.x86_64pgdg104.4 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg24.04+1_amd64.deb
postgresql-14-pg-hint-plan1.4.4u24.aarch64pgdg101.1 KiBpostgresql-14-pg-hint-plan_1.4.4-1.pgdg24.04+1_arm64.deb

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pg_hint_plan;		# install via package name, for the active PG version

pig install pg_hint_plan -v 18;   # install for PG 18
pig install pg_hint_plan -v 17;   # install for PG 17
pig install pg_hint_plan -v 16;   # install for PG 16
pig install pg_hint_plan -v 15;   # install for PG 15
pig install pg_hint_plan -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_hint_plan';

Create this extension with:

CREATE EXTENSION pg_hint_plan;

Usage

pg_hint_plan: Give PostgreSQL ability to manually force some decisions in execution plans

pg_hint_plan overrides the PostgreSQL query planner’s decisions using SQL comment hints, allowing you to force specific scan methods, join strategies, and join orders.

Hint Syntax

Hints are embedded in SQL comments prefixed with /*+ and closed with */:

/*+
  HashJoin(a b)
  SeqScan(a)
*/
SELECT *
FROM pgbench_branches b
JOIN pgbench_accounts a ON b.bid = a.bid
ORDER BY a.aid;

Scan Method Hints

HintDescription
SeqScan(table)Force sequential scan
IndexScan(table [index...])Force index scan (optionally restrict to specific indexes)
IndexOnlyScan(table [index...])Force index-only scan
BitmapScan(table [index...])Force bitmap scan
TidScan(table)Force TID scan
NoSeqScan(table)Prevent sequential scan
NoIndexScan(table)Prevent index scan and index-only scan
NoIndexOnlyScan(table)Prevent index-only scan
NoBitmapScan(table)Prevent bitmap scan
NoTidScan(table)Prevent TID scan
IndexScanRegexp(table [regexp...])Force index scan with regex-matched index names
DisableIndex(table index...)Disable specific indexes during planning

Join Method Hints

HintDescription
NestLoop(t1 t2 [t3...])Force nested loop join
HashJoin(t1 t2 [t3...])Force hash join
MergeJoin(t1 t2 [t3...])Force merge join
NoNestLoop(t1 t2 [t3...])Prevent nested loop join
NoHashJoin(t1 t2 [t3...])Prevent hash join
NoMergeJoin(t1 t2 [t3...])Prevent merge join
Memoize(t1 t2 [t3...])Allow memoization of inner result
NoMemoize(t1 t2 [t3...])Prevent memoization

Join Order Hints

-- Simple left-deep join order
/*+ Leading(a b c) */

-- Explicit join tree with nesting
/*+ Leading((a (b c))) */

Row Number Correction

/*+ Rows(a b #100) */    -- Set to absolute number
/*+ Rows(a b +100) */    -- Add to estimate
/*+ Rows(a b -100) */    -- Subtract from estimate
/*+ Rows(a b *2.0) */    -- Multiply estimate

Parallel Query Control

/*+ Parallel(table 4 hard) */   -- Force 4 parallel workers
/*+ Parallel(table 0 hard) */   -- Disable parallelism

GUC Parameter Override

/*+ Set(random_page_cost 1.0) Set(seq_page_cost 1.0) */
SELECT * FROM my_table WHERE id = 42;

GUC Configuration

ParameterDescriptionDefault
pg_hint_plan.enable_hintEnable or disable hints globallyon
pg_hint_plan.enable_hint_tableEnable hint table for query-based hintsoff
pg_hint_plan.debug_printPrint debug info for applied hintsoff
pg_hint_plan.parse_messagesLog level for hint parsing messagesINFO
pg_hint_plan.message_levelLog level for debug messagesLOG
Last updated on