Postgresql tricks | Lanre Adelowo
I was recently caught up in a Twitter thread where someone suggested using a materialized view for calculating some value from another table. I suggested using a TRIGGER instead as it happens in the same transaction. Someone DM'd me saying it solved a problem he has been having at work with poor performance while they are trying to update another table as they were doing it via code, fetching all data, then iterating to calcualate the difference. Asides that, it meant the table was out of sync when they get concurrent requests. I then decided to list some of my favorite and useful postgresql features. Might find them useful. Might not :) but here is a tiny list: weird bug, links to sections do not work, so you might need to scroll. Currently fixing as soon as i can find time. apologies :))) please don't do this in production lmao so as not to make people start thinking silly data is still stored. I really hope you hate nulls as much as I do. But sometimes we just need to keep them arou
back May 11, 2023 Postgresql tricks 10 min read Tags database I was recently caught up in a Twitter thread where someone suggested using a materialized view for calculating some value from another table. I suggested using a TRIGGER instead as it happens in the same transaction. Someone DM'd me saying it solved a problem he has been having at work with poor performance while they are trying to update another table as they were doing it via code, fetching all data, then iterating to calcualate the difference. Asides that, it meant the table was out of sync when they get concurrent requests. I th
Explore this link on the map →related reading
- Nine ways to shoot yourself in the foot with PostgreSQLphilbooth.me
- Explaining The Postgres Memeavestura.dev
- Materialized views are obviously useful – Sophie Alpertsophiebits.com
- PostgreSQL: Documentation: 18: 37.1. Overview of Trigger Behaviorpostgresql.org
- Is a PostgreSQL trigger asynchronous? - Stack Overflowstackoverflow.com
- The only scalable delete in Postgres is DROP TABLE — PlanetScaleplanetscale.com
- debezium-examples/postgres-toast at main · debezium/debezium-examples · GitHubgithub.com
- postgresql - How can I ensure that a materialized view is always up to date? - Stack Overflowstackoverflow.com
- PostgreSQL rocks, except when it blocks: Understanding locks - Citus Datacitusdata.com
- Ingest data from self-hosted PostgreSQL | Materialize Documentationmaterialize.com
- PostgreSQL CDC - RisingWavedocs.risingwave.com
- Schedule | POSETTE: An Event for Postgres 2024 - Citus Datacitusdata.com