Very slow postgresql aggregation
When you running "alone", if you mean running it in "psql" but just without the EXPLAIN ANALYZE, then "psql" is reading the entire result set into memory, and going over that set deciding how long the longest entry is for each column so that it can format it to that length.  That can be slow, though I would not expect 30 seconds for 2317 lines!  

Except I see you don't have a "corr" column in your "corr" table, so what you are aggregating is the entire row records, which you already said has a column that can be very wide.  So you are slinging a huge amount of data at psql, and it takes a long time to process it, plus maybe doing some swap.