On 20.2.2015 22:45, Kevin Grittner wrote: > > Oracle, MS SQL Server, Sybase ASE, and IBM DB2 all have this. (There > may be others.) In essence they treat an MV a bit like an index, as > something you can create to speed up an existing query without > rewriting it. It would certainly be nice to have this in PostgreSQL, > too, in my opinion.
Yeah. The trouble is indexes are up-to-date, but MVs may not be - there might be changes since the last REFRESH, which makes the rewrite more complex. We don't want to use stale MVs for the rewrite, so we'd have to identify the stale MVs somehow - AFAIK we don't have a flag for that. > That seems extraordinarily difficult for a GSoC project. Unless you > can demonstrate mastery of the concepts involved in such > optimizations, and a familiarity with the PostgreSQL planner, with a > plan to put forward for how you would do this I think you should set > a more modest goal. Perhaps you could find something to work on > related to the planner that is small enough to be achieved in the > limited time allowed for a GSoC project, that would move you closer > to taking on something this big. I share the view that this would be very valuable, but the scope far exceeds what can be done within a single GSoC project. But maybe we could split that into multiple pieces, and Eric would implement only the first piece? For example the 'is_stale' flag for a MV would be really useful, making it possible to refresh only the MVs that actually need a refresh. -- Tomas Vondra http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers