pg_mentor
pg_mentor - manage query parameters
pg_mentor · pg_mentor - manage query parameters
Overview
Usage
Sources:
- Official upstream README
- Official extension control file (pg_mentor.control)
- Official extension SQL (pg_mentor–0.1.sql)
pg_mentor — Lightweight extension that employs query statistics stored in the pg_stat_statements extension to decide which type of plan mode (custom, generic or auto) to use. Use it when administering or automating the database behavior described above. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.
Core Workflow
Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.
Important Objects
pg_mentor_nail_long_planned()is an extension function and returnsinteger.pg_mentor_reload_conf(void)is an extension function.pg_mentor_reset()is an extension function and returnsinteger.pg_mentor_set_plan_mode(queryId bigint, status integer, ref_total_time float8 DEFAULT NULL, ref_nblocks float8 DEFAULT NULL, fixed bool DEFAULT false)is an extension function.pg_mentor_show_prepared_statements(IN status integer, OUT queryid bigint, OUT refcounter integer, OUT plan_cache_mode int, OUT since TimestampTz, OUT fixed boolean, OUT statnum integer, OUT nblocks bigint[], OUT exec_times float8[], OUT avg_nblocks float8, OUT avg_exec_time float8, OUT ref_nblo…)is an extension function and returnsSETOF.reconsider_ps_modes(OUT to_generic bigint, OUT to_custom bigint, OUT unchanged bigint)is an extension function and returnsrecord.
Requirements and Caveats
- The reviewed control file declares default version
0.1. - The control file marks the extension as relocatable.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.