postgresql_16:6.10.1.29.1 Description
PostgreSQL 16 > Server Programming > Server Programming Interface > Interface Functions > SPI_saveplan > Description
SPI_saveplan copies a passed statement (prepared by SPI_prepare) into memory that will not be freed by SPI_finish nor by the transaction manager, and returns a pointer to the copied statement. This gives you the ability to reuse prepared statements in the subsequent invocations of your C function in the current session.