Analysing SQL Queries

Make use of EXPLAIN clause in your database engine to run a query analyse: EXPLAIN SELECT user_id , COUNT ( DISTINCT ( user_id )) FROM users . post GROUP BY user_id HAVING COUNT ( DISTINCT ( user_id )) > 1 ; It will show you how the query is being executed: | QUERY PLAN | | ----------------------------------------------------------------------------- | | GroupAggregate (cost=790088.08..848298.55…