yes, I have to make that because the data on the table need to be pivoted so it is joined many times with different filter on the column that describe the meaning of the column called numeric_value I'm going to show. That could be very ineffective, event because that table contains something like 25000000 rows... There are two tables in this condition (as you can se in the explain) and both are the table with the higher number of rows in the database. But I don's see any other choice to obtain that information. P.S.: i'm trying with all enable_* to on and pumping to higher values from_collapse_limit and join_collapse_limit that I've put to 30. The result is that the query, after an hour of work, goes out of memory (SQL State 53200)... -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance