Is there a way to optimize such a query in PostgreSQL 9.5, 9.6?
SELECT x FROM (
SELECT x,count(x) cnt FROM very_big_table WHERE (conditions) GROUP BY x
) sub
WHERE cnt > 10
Indexes to all WHERE conditions and x is obvios. Any other suggestions?