sraoss / pg_ivm

IVM (Incremental View Maintenance) implementation as a PostgreSQL extension
Other
854 stars 24 forks source link

Outer Joins and IVM #48

Open koureasstavros opened 1 year ago

koureasstavros commented 1 year ago

I understand the difficulty of having outer joins on incremental materialized views but I think this could be a huge enhancement into PostgreSQL, it would be the perfect combination for near to real time analytics with lightweight modifications to get rid of the old ETL Style of staging and datawarehouse. Most of the transformations usually includes outer joins.

The difficulty just for memorial purposes (based on MS White Paper): A. Rows can logically disappear from an indexed view based on OUTER JOIN when you insert data into a base table. This makes incrementally updating OUTER JOIN views relatively complex to implement, and the performance of the implementation would be slower than for views based on standard (INNER) JOIN.

yugo-n commented 1 year ago

Actually, we have already an outer-join support implementation although it is not pushed in pg_ivm repository. I plan to support it in the near future release.

However, there are a few restrictions in the implementation; for example, columns used in the join condition must appear in the target list, and using an outer-join with an aggregate or DISTINCT is not allowed, etc. (It might be improved in future release, though.)

koureasstavros commented 1 year ago

Hmm that's sounds interesting, thanks a lot for providing this information and I appreciate your work on the Incremental Materialized Views. In case you want people to test this new enhancement just let me know.

One last thing, you mention that outer-join with an aggregate or DISTINCT is not allowed, but what about GROUP BY? Do we really need DISTINCT?

artu-ole commented 1 year ago

@yugo-n Hi there! We'd also be very interested to do some tests with it, do you any updates on the matter?

yugo-n commented 1 year ago

@koureasstavros Sorry for my late reply.

One last thing, you mention that outer-join with an aggregate or DISTINCT is not allowed, but what about GROUP BY? Do we really need DISTINCT?

In the current pg_ivm, GROUP BY without aggregate functions are not allowed, so GROUP BY will not be used with outer-join. Maybe, DISTINCT can be used with outer-join although I have to check it carefully....

yugo-n commented 1 year ago

@yugo-n Hi there! We'd also be very interested to do some tests with it, do you any updates on the matter?

Currently, we plan to release pg_ivm supporting outer-join by this Summer or Autumn.

koureasstavros commented 7 months ago

Hi @yugo-n, is there any news on pg_ivm supporting outer joins?

ShadowNight001 commented 3 months ago

Is there any news ?

konstantingreger commented 1 month ago

Hi @yugo-n, we would also be very interested in IVM supporting outer joins and are happy to test for you!