> When we declare a cursor for a select on the mentioned big table, it takes > multiple seconds and a big temp file is created which to me seems like the > materialization took place immediately.
Since you mentioned, Postgres already postponed materialization until commit operations we checked again and you were right. When we manually checked, we executed a "declare" statement without opening a transaction block first, which causes instant materialization. When a transaction is opened, it is in fact postponed. Unfortunately we do not use cursors but portals so we can (re-)use prepared statements in multiple instances and there is not "hold" feature for portals so we cannot benefit from the lazy "with hold" of the cursor. -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers