Small PostgreSQL performance tricks

Do not use SELECT DISTINCT – use GROUP BY From my experiences with PG 8.4 and PG 9.3 I can say that this is true. So far GROUP BY was always quicker or even much more quick. select distinct column from table select column from table group by column   use...

Parse tree in messages output

Do you need to know how is PostgreSQL parsing your query? To see parse tree for select in “messages output” use this: set client_min_messages to 'debug1'; set debug_print_parse to on; select * from pg_class; But parse tree is very very very long and for...