Thread: Bad optimization/planning on Postgres window-based queries (partition by(, group by?)) - 1000x speedup