Progrider

Programming discussion

Search

Searches topics and replies. Every word has to appear in the post.

23 posts found.

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 !izYA-5cv
Help · post #3

idle in transaction, 9 days, a reporting tool someone left open. thank you


by Anonymous
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 long-running transaction, idle in trans…


by marta_k !izYA-5cv
Help · post #1

Table has maybe 2 million rows and takes 60GB. A row is around 200 bytes. Updates a lot. Is this normal? autovacuum is on.


by Anonymous
Help · post #3

Yep, .env still said localhost. Changed to db and it connected. Resolved.


by sam
Help · post #2

Inside the web container, localhost is the web container. Use the service name: postgres://...@db:5432/. Check DATABASE_URL in your .env, it's probably still localhost from running outside docker.


by Anonymous
Help · post #1

Two services in docker compose, web and db. Web fails with ECONNREFUSED 127.0.0.1:5432 even though db is up and the logs say it's accepting connections. Works fine when I run the app outside docker. What am I missing?


by sam
Help · post #13

Just did this at work and this thread saved me a bad hour. thank you whoever you are


by Anonymous
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 !izYA-5cv
Findings · post #2

OOMScoreAdjust. Typo. Can't edit here.


by dmesg_reader
Findings · post #1

Small box. A python job leaked until the kernel had to choose, and it chose postgres since it had the biggest RSS. Read dmesg, it's all there, including the score. Set this on the service you want to keep: [Service] OMScoreAdjust=-500 and l…


by dmesg_reader
Help · post #12

Off. All good now, marking this one resolved.


by nils !PxNS1ZCy
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 !izYA-5cv
Help · post #10

880ms. Old package was built without LLVM support, turns out. Debian's has it.


by nils !PxNS1ZCy
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 again.


by marta_k !izYA-5cv
Help · post #8

Top of it is: JIT: Functions: 42 Options: Inlining true, Optimization true, Expressions true, Deforming true Timing: Generation 8.1 ms, Inlining 310.2 ms, Optimization 612.4 ms, Emission 201.9 ms, Total 1132.6 ms Execution Time: 2041.8 ms


by nils !PxNS1ZCy
Help · post #7

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


by marta_k !izYA-5cv
Help · post #6

Back to 20ms on most of it. Thanks. Still one report query that's slower than before, 2s where it was 900ms.


by nils !PxNS1ZCy
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 !izYA-5cv
Help · post #4

Running. There's a line about it in the output I had scrolled past.


by nils !PxNS1ZCy
Help · post #3

Oh.


by nils !PxNS1ZCy
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 !izYA-5cv
Help · post #1

Upgraded a small Postgres box over the weekend with pg_upgrade --link. It came up fine, no errors. Queries that took 20ms now take 8 seconds. Same hardware, same config carried across. One example does a seq scan on a 40M row table when the…


by nils !PxNS1ZCy
All times shown in UTC.