Will Postgres push down a WHERE clause into a VIEW with a Window Function (Aggregate)?

*爱你&永不变心* 提交于 2019-12-05 03:03:20

No, PostgreSQL will only push down a WHERE clause on a VIEW that does not have an Aggregate. (Window functions are consider Aggregates).

< x> I think that's just an implementation limitation

< EvanCarroll> x: I wonder what would have to be done to push the WHERE clause down in this case.

< EvanCarroll> the planner would have to know that the WindowAgg doesn't itself add selectivity and therefore it is safe to push the WHERE down?

< x> EvanCarroll; a lot of very complicated work with the planner, I'd presume

And,

< a> EvanCarroll: nope. a filter condition on a view applies to the output of the view and only gets pushed down if the view does not involve aggregates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!