We are using logical replication to sync data into a table. Perfect solution so far!
The problem now is we need triggers on this subscriber table. Those triggers make heavy calculations (think of calculating balances and aggregated data from the "raw" data in the subscriber table). That's why FOR EACH STATEMENT trigger would be preferable. We definitely wanna avoid that those calculations happen on every single row insert.
Documentation (https://www.postgresql.org/docs/current/logical-replication-architecture.html) says:
The logical replication apply process currently only fires row triggers, not statement triggers.
Any ideas how we can achieve something similar without FOR EACH STATEMENT trigger? Keeping those two tables in sync - the subscriber table with the raw data & the table with calculated/aggregated data?