This message was deleted.
# puppet-enterprise
s
This message was deleted.
n
that’s big afaik. Would expect pg_repack to be taking care of the bloat though
b
yeah that's another issue 😄 I've ~36GB free disk space, not enough for pg_repack to finish
n
sounds like the same issue 🙂
b
next week I can extend the VM with more storage, hopefully pg_repack can free up some space afterwards
n
you could drop and recreate the index which will shrink it and doesn’t require extra space
just don’t screw it up 🙂
b
Already had that in mind 😄
but I wasn't sure how much waste actually is in the index/how much I would gain from that action
n
the index should never be bigger than the table so at a minimum you’re talking about getting 47 GB back
but the table is probably really bloated as well
b
you mean dead tuples or tuples Puppet somehow didn't delete?
I did a count on that table, was around 1.400.000 entries
n
of tuples or dead tuples?
like what is
select count(*) from resource_params
I thought it was only a few hundred rows normally
b
I did
select count(*) from resource_params
I couldn't really figure out the purpose of that table. all parameters for all resources in all catalogs?
n
maybe, I don’t remember
b
we were able to reduce this by roughly 50% diskspace with
REINDEX TABLE resource_params
. that requires a write-lock, so maybe don't do that during a huge DB load
n
yea that’s why we use pg_repack
🙂 you should be able to us pg_repack on a single index as well
b
I didnt have enough disk space for pg_repack :D
at least not on a whole table. didnt try it on an index
but now that reindex is done, I was able to run pg_repack on most tables
in one case it couldnt aquire a lock, because the database was too busy. I meed to digure out how to handle that
n
In my experience the answer is add more RAM. If any of the most used queries need to read anything off disk that’s going to cost you alot. You should ideally be able to fit all of the database other than the reports and resource_events tables in memory
b
mhm, that would require +50gb of memory I think. need to check tomorrow
n
reaching back in my brain I think you can turn on something that will cause query plans to to get logged for longer than x seconds. Once you have that you can use pg_badger to see your slowest queries and look at the query plans ( shown right in the pg_badger html ) to see if they are spending time reading from disk
b
ah good idea. I think I already enabled slow query log
the big indexes with huge amount of dead tuples caused those queries to run forever. they disappeared from the slow query log after the REINDEX + pg_repack. So I think it's fixed now
after the optimization the query is executed in 30min with EXPLAIN: https://explain.depesz.com/s/ReYu#source . I'm not sure if the seq scans could be mitigated with an index or if the query is even required