pre_prepare
preprepare : Pre Prepare your Statement server side
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5170 | pre_prepare | preprepare | 0.9 |
ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_hint_plan plan_filter pg_query_rewrite hypopg pg_qualstats index_advisor online_advisor pg_stat_plans pg_kpart pg_fsql |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 0.9 |
18 17 16 15 14 | preprepare |
- |
| RPM | PIGSTY | 0.9 |
18 17 16 15 14 | preprepare_$v |
- |
| DEB | PGDG | 0.9 |
18 17 16 15 14 | postgresql-$v-preprepare |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| el8.aarch64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| el9.x86_64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| el9.aarch64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| el10.x86_64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| el10.aarch64 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 | PIGSTY 0.9 |
| d12.x86_64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| d12.aarch64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| d13.x86_64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| d13.aarch64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u22.x86_64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u22.aarch64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u24.x86_64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u24.aarch64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u26.x86_64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
| u26.aarch64 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 | PGDG 0.9 |
Source
github.com/dimitri/preprepare
preprepare-0.9.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
pre_prepare automatically prepares SQL statements at connection time so clients can directly use EXECUTE without calling PREPARE first.
Setup
Configure in postgresql.conf:
Create a table to store statements:
Insert statements (include the full PREPARE syntax):
Functions
prepare_all() – Prepare all statements from the configured relation:
prepare_all('schema.table') – Prepare statements from a specific table:
discard() – Like DISCARD ALL but without DEALLOCATE ALL (preserves prepared statements):
With PgBouncer
Set connect_query to auto-prepare on each server connection:
Avoid using DISCARD ALL as your reset_query (it would deallocate the prepared statements).