other than general tuning, I think the below feature for future?
versions maye be of great help.
PostgreSQL: Implementing Incremental View Maintenance
<https://www.postgresql.org/message-id/flat/20181227215726(dot)4d166b4874f8983a641123f5(at)sraoss(dot)co(dot)jp>
Incremental materialized view maintenance for PostgreSQL 14? - Blog dbi
services (dbi-services.com)
<https://blog.dbi-services.com/incremental-materialized-view-maintenance-for-postgresql-14/>