Ram consumed by single query in Postgres using SqlAlchemy I have a list of 36 queries ranging from low complexity(No joins) to high complexity(joins with subquery). I want to find the RAM Consumed by each query. 

This is required for performance testing for the application which I am building.

Can anyone please help with the same? 

I am creating a SQLAlchemy session object and executing raw queries directly.
You can turn on "log_statement_stats", and look at the 'max resident size' line from the log file (or set client_min_messages TO log;).

Is is a pretty crummy interface, and the number it gives is the high water mark for the connection, so you would have to run each statement in a separate connection while testing it.