Hacker News new | ask | show | jobs
by tomasol 17 days ago
Everybody learns. Coming from other databases it might not be obvious that you need to enable vacuum explicitly.
2 comments

In other databases, you also don't get the space back (mostly [0]). Postgres requires VACUUM FULL (or REPACK CONCURRENTLY, as of Pg19), and MySQL requires OPTIMIZE TABLE, neither of which is commonly done.

This is my point; if you're coming from other databases, it should be obvious that you don't get space back unless you ask for it.

0: Postgres can, under the specific circumstance of pages at the end of a table being completely empty, release them back to the OS with a normal VACUUM.

Especially if you started in an age of remote cloud databases. The further we get away from the infrastructure we use, the less we know about nuances like this. What used to be considered common knowledge gets lost when you don't have experience with running a DB server.

I mean, today, why would you? It used to be that starting a new CRUD project meant at least an hour of setting up web servers, database servers, proxies, etc. Today, that's all abstracted away for pennies an hour.

> Today, that's all abstracted away for pennies an hour.

Until it isn't. "Why is my query slow" doesn't get solved just because you didn't have to run apt-get install postgresql.

EDIT: the company also discusses working with Postgres [0], and man do they have some takes. work_mem set to 600 MB, using a temporary table for active queries while copying its rows to the main table (their pg_catalog has to be MASSIVE), generating a table per query on a "cache DB," resulting in millions of tables that are then dropped at EOD...

This is my point. Even if these were running on RDS (they aren't), they would still be causing performance problems, because you need to understand how your tooling works to use it well at scale.

0: https://zerodha.tech/blog/working-with-postgresql/