Re: Idea: GSoC - Query Rewrite with Materialized Views - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Idea: GSoC - Query Rewrite with Materialized Views
Date
Msg-id 54E7AE12.9030300@2ndquadrant.com
Whole thread Raw
In response to Re: Idea: GSoC - Query Rewrite with Materialized Views  (Kevin Grittner <kgrittn@ymail.com>)
Responses Re: Idea: GSoC - Query Rewrite with Materialized Views  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Enforce creation of destination folders for source files in pg_regress (Was: pg_regress writes into source tree)
Next
From: Alvaro Herrera
Date:
Subject: Re: NOT NULL markings for BKI columns