There&#x27;s no reason for SELECT COUNT(DISTINCT x)) to perform badly in Postgres, as long as you have an appropriate table design and indexes.<p>Also MSSQL&#x27;s query planner isn&#x27;t better than Postgres&#x27;, I work with both. Postgres does have its quirks though, especially with the MVCC row expiry.