På onsdag 05. august 2015 kl. 20:25:25, skrev Maxim Boguk <maxim.bo...@gmail.com <mailto:maxim.bo...@gmail.com>>: [snip] I think I know where issue is. The PostgreSQL planner unable pass join conditions into subquery with aggregate functions (it's well known limitation). [snip]
I'm curious; will 9.5 help here as it has "WHERE clause pushdown in subqueries with window functions"? http://michael.otacoo.com/postgresql-2/postgres-9-5-feature-highlight-where-pushdown-with-window-function/ Are you able to try 9.5 and post the results? Thanks. -- Andreas Joseph Krogh CTO / Partner - Visena AS Mobile: +47 909 56 963 andr...@visena.com <mailto:andr...@visena.com> www.visena.com <https://www.visena.com> <https://www.visena.com>