6
votes
Accepted
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
optimization × 1950mysql × 712
performance × 616
sql-server × 534
query-performance × 493
postgresql × 358
index × 212
execution-plan × 161
database-design × 97
join × 84
innodb × 80
oracle × 74
mariadb × 64
sql-server-2012 × 63
postgresql-performance × 61
index-tuning × 60
query × 56
subquery × 56
sql-server-2014 × 49
sql-server-2016 × 48
t-sql × 46
sql-server-2008-r2 × 36
mysql-5.5 × 36
mysql-5.7 × 36
mysql-5.6 × 34