I love it!
Only issue is if you can't consume the history of changes.
But this is good for caching materialized view in the client
1- subscribe to event and buffer event
2- run SQL query for your materialized view
3- apply all buffered event and new event to incrementally update the materialized view
this way the (slow/expensive) query of the materialized view don't need to be run periodically and your cache always is always fresh without need to set TTL.
If you websocket connection get disconnected, drop the materialized view and repeat step #1.
1- subscribe to event and buffer event
2- run SQL query for your materialized view
3- apply all buffered event and new event to incrementally update the materialized view
this way the (slow/expensive) query of the materialized view don't need to be run periodically and your cache always is always fresh without need to set TTL.
If you websocket connection get disconnected, drop the materialized view and repeat step #1.