Email or username:

Password:

Forgot your password?
Darius Kazemi

Have any Mastodon or Hometown admins out there ever done a `pg_repack` on their postgres DB? I have seen admins say that it reduced DB size quite efficiently, and I've found some non-Mastodon-specific tutorials, but what would really help me is the actual command and options to invoke on the CLI that have successfully not broken a mastodon DB in the past

16 comments
Darius Kazemi

I used to run VACUUM on my DB regularly, but I read multiple places that it's not recommended for postgres 12 because it now basically auto-vacuums? I guess? Can you tell I don't understand much about postgres??

DELETED

@darius unless you have special needs, let PostgreSQL do its own thing.

oberhamsi

@darius you can config the auto vacuum but unless you need or do something special (eg big import or delete) it works well

Maybe it's Eyesaline

@darius autovacuum has been a thing for years. If you're running production stuff on postgres, I strongly recommend that you disable autovacuum and run it manually on a schedule, during off-peak hours.

Thing about auto VACUUM is that postgres can decide to do it whenever. And if that's peak hours, the overhead of it will tank performance and can take down production.

Michael Sokolov

@darius I have no idea, all I know is backup should be step One

Darius Kazemi

@msokolov heh yes pg_dump and restore is basically the ONLY thing I am confident with at this point

Francis πŸ΄β€β˜ οΈ Gulotta

@darius @msokolov it’s fairly safe but I can’t remember if it locks the table or what, but yeah def backup first.

Nolan Lawson

@darius At some point I believe even mastodon.social was running a Postgres extension to auto-vacuum. I believe it was this one: reorg.github.io/pg_repack/

I was never brave enough. πŸ˜•

Darius Kazemi

@nolan anyway lol I did some more investigation and my DB size isn't that bad, there were some big stray logfiles that tricked me into thinking my DB was bigger than it was on a `du`

Nolan Lawson

@darius Hah, my reading comprehension is down the drain recently. πŸ˜… Makes sense.

Dr. Matt Lee

@darius I did it once on the libre.fm database. Took forever.

tim πŸ“

@darius if you still have your test environment up, maybe you could dump and restore into that and test it out there? I dunno if the db is all the data needed to run

a pup of coffee :v_agender: :bowie: β˜•

@darius I'm definitely interested in anything that can improve our DB as well

Go Up