Progrider

Programming discussion

Posts by marta_k

16 public posts under this name. There are no accounts here: names are free text and anyone can type any name, so these may not all be the same person.

PostPosted
Help · post #14

For anyone arriving here now: 18 keeps most planner stats through pg_upgrade. You still want vacuumdb --all --analyze-in-stages --missing-stats-only, the release notes have details.


by marta_k
Findings · post #3

Welcome to having types.


by marta_k
Help · post #2

You know the answer. Store UTC. In Python that's datetime.now(timezone.utc), or use integer epoch. Convert when you display. For the old rows, you can't tell the two 01:30s apart from the text alone, …


by marta_k
Help · post #2

That's bloat. Check first whether autovacuum is keeping up: SELECT relname, n_dead_tup, last_autovacuum FROM pg_stat_user_tables ORDER BY n_dead_tup DESC LIMIT 5; If last_autovacuum is old, look for a…


by marta_k
Findings · post #2

node-postgres gives you bigint columns as strings by default, for this reason. Someone will then "fix" that with parseInt.


by marta_k
Findings · post #2

"Identifiers aren't numbers" should go on a wall somewhere. Leading zeros have ruined more imports than bad encodings.


by marta_k
Findings · post #3

The same holds in Postgres. And on either one, if the query selects only columns that are in the index, you can skip the table entirely. Bonus speedup that people miss.


by marta_k
Findings · post #3

Better still to run the job with a MemoryMax= so it dies first without involving the OOM killer at all. Postgres getting a SIGKILL means a crash restart of everything.


by marta_k
General · post #17

Happens in Postgres as well, just with more connections piling up before you notice.


by marta_k
Help · post #11

You can leave it on and raise jit_above_cost, or turn it off for that role. For a small OLTP box I'd just turn it off.


by marta_k
Help · post #9

There's your extra second. It has decided the query's expensive enough to compile. Was jit off in your old config, or was it a different package build? Try SET jit = off in the session and run it agai…


by marta_k
Help · post #7

EXPLAIN (ANALYZE, BUFFERS) it and paste it. Change the table names if you need to.


by marta_k
Help · post #5

The in-stages version does a very rough pass first, so the worst of it clears up fast. Then finer passes. Check pg_stat_user_tables, last_analyze should be getting filled in.


by marta_k
Help · post #2

Did you run the analyze step? pg_upgrade doesn't bring the planner statistics across, so right now it's guessing. It prints this at the end and everybody misses it. vacuumdb --all --analyze-in-stages


by marta_k
General · post #10

If it gets there, migrating to Postgres is a known week of work, and you've saved a couple of years of running it. The bigger trap is type sloppiness. SQLite will let you put text in an INTEGER column…


by marta_k
General · post #3

I run Postgres for a living and I'd say use SQLite for this. The question that matters is how many writers and whether they hold transactions open. One writer at a time, so if you do a slow thing insi…


by marta_k
All times shown in UTC.0 topics, 16 replies