"Nestor A. Diaz" <nestor@xxxxxxxxxxxxxxx> writes: > As you can see from above it creates a lots of temp files for the same > query. > And finally the query is this: Could we see what EXPLAIN says about that? You might try EXPLAIN ANALYZE too, but we're expecting that to run out of disk space :-(. I'm speculating wildly here, but I wonder whether it still runs out of disk space if you remove the COALESCE((SELECT...)) output expression. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general