6 votes

Partitioned view aggregation query not optimized

The SQL Server optimizer has two main ways to push an aggregate down past a union all. 1. Global Pushdown The first rule is GbAggBelowUniAll. It's a fairly straightforward transform that moves the ...
Paul White's user avatar
  • 82.1k
1 vote

PostgreSQL Query Planner overestimating Row Count leads to slow Hash Join

First, try to gather accurate statistics: ANALYZE a; If that doesn't help, you can choose the ugly solution of rewriting the query so that you force a nested loop join: SELECT count(*) FROM a CROSS ...
Laurenz Albe's user avatar
  • 45.5k

Only top scored, non community-wiki answers of a minimum length are eligible