2021-08-02

Reducing the size of IVM patch set

In the last three posts [1, 2, 3], I've covered the features, performance, and implementation of Incremental View Maintenance (IVM)  that we are proposing as a new feature of PostgreSQL.
 

In the current code in the repository, the IVM implementation supports views whose definition query contains SELECT ... FROM ... WHERE ..., joins (including self-join and outer joins),  some built-in aggregate functions (count, sum, avg, min and max), DISTINCT clause, some types of sub-queries, and CTEs. Also,  the view can contain multiple tuples with the same content (duplicate tuple support).

As you can imagine, we made large changes for the original PostgreSQL code for implementing all the above features.  As the result, the size of patch set proposed to the development community  has grown too large. This would cause to make it hard to review the patch.

We hope the IVM feature will be adopted into PostgreSQL 15. Therefore, we decided to reduce the size of patch by omitting a part of features in the first release in order to make the review easier. Especially, I would like propose the IVM  supporting inner join, DISTINCT, some built-in aggregates, and views with tuple duplicates as a new feature of PostgreSQL 15. Support for outer-join, sub-queries, and CTEs are excluded here. As a result,  the size of the latest patch size became less than half of the previous.