On Sun, Jan 8, 2017 at 11:35 AM, David L <segedunum@actuaria.co.uk> wrote: > I agree that in theory this shouldn't happen as the query planner should be > intelligent enough to take the base query out of the equation all together, > but this happens on a server where there should be a plentiful supply of > memory (32GB) and little enough activity that table data should remain > cached.
I'm not sure you understand the underlying method for views in postgresql.
Select * from view;
is literally changed into
select * from (yourviewdef here).
I.e. the query planner does NOTHING different for a select from a view than if you just run the query that makes the up the view by hand.