Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1016 Bytes

File metadata and controls

53 lines (35 loc) · 1016 Bytes

benching

This example demonstrates the new in-process #[pg_bench] workflow.

It includes:

  • a simple pure-Rust benchmark that exercises a string transform
  • a mutating SPI benchmark that uses setup = prepare_spi_fixture and transaction = "subtransaction_per_batch"

Layout

Benchmarks live under:

#[cfg(feature = "pg_bench")]
#[pg_schema]
mod benches { ... }

The pg_bench feature is intentionally separate so benchmark wrappers and helper dependencies are not shipped in a normal extension build.

Running

From this directory:

cargo pgrx bench

Or choose an explicit Postgres version and group name:

cargo pgrx bench pg16 --group-name initial-run

To compare against a named prior group:

cargo pgrx bench --compare-group initial-run

To print the backend PID and leave time to attach a profiler or debugger:

cargo pgrx bench --wait 10

To inspect the SQL-visible wrappers without running them:

cargo pgrx bench --list