I need a mechanism to keep my queries in optimized state so that multiple processes can use them.
You should use stored procedures then.
For instance, say you want to keep 'SELECT * FROM table WHERE id=x' prepared. You would go:
CREATE OR REPLACE FUNCTION get_table_id(integer) RETURNS SETOF table AS 'SELECT * FROM table WHERE id=$1' LANGUAGE SQL;
PostgreSQL will store a prepared version of that statement after its first use.
You use it like this:
SELECT * FROM get_table_id(3);
Chris
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq