aka Parameterized Query
PREPARE foo(int) AS
SELECT * FROM users where id = $1;
EXECUTE foo(1);
DEALLOCATE foo;
- Prepared statements only last for the duration of the current database
session, but can be cleaned up manually with
DEALLOCATE
- See Postgres PREPARE