From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Kevin Brannen <KBrannen@efji.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: how to slow down parts of Pg
Date: Wed, 22 Apr 2020 09:19:05 +0200
Message-ID: <63b750ab4d35937cc1abe75387ce39050c2dc8f0.camel@cybertec.at> (raw)
In-Reply-To: <SA0PR19MB425585C98C339C35A4A5343AA4D50@SA0PR19MB4255.namprd19.prod.outlook.com>
References: <SA0PR19MB425585C98C339C35A4A5343AA4D50@SA0PR19MB4255.namprd19.prod.outlook.com>
On Tue, 2020-04-21 at 20:30 +0000, Kevin Brannen wrote:
> I have an unusual need: I need Pg to slow down. I know, we all want our DB to go faster,
> but in this case it's speed is working against me in 1 area.
>
> We have systems that are geo-redundant for HA, with the redundancy being handled by DRBD to keep the disks in sync,
> which it does at the block level. For normal operations, it actually works out fairly well. [...]
> The part that hurts so bad is when we do maintenance operations that are DB heavy, like deleting really old records out of
> archives (weekly), moving older records from current tables to archive tables plus an analyze (every night),
> running pg_backup (every night), other archiving (weekly), and vacuum full to remove bloat (once a quarter).
> All of this generates a lot of disk writes, to state the obvious.
>
> The local server can handle it all just fine, but the network can't handle it as it tries to sync to the other server.
The obvious and best answer is: get a faster network, or choose a different
storage solution.
Other than that, you can try to make the maintainance operations less
resource intense:
- partition the tables so that you can get rid of old data with DROP TABLE.
The ANALYZE won't hurt, if you treat only the required tables.
- use "pg_basebackup" with the "--max-rate" option
About VACUUM, you may have a problem. Avoid the need for VACUUM (FULL) at any price.
That usually requires tuning autovacuum to be faster, which means using more I/O.
If you cannot find a sweet spot there, you have no alternative but getting better I/O
(which, as I said in the beginning, would be the correct solution anyway).
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, KBrannen@efji.com
Subject: Re: how to slow down parts of Pg
In-Reply-To: <63b750ab4d35937cc1abe75387ce39050c2dc8f0.camel@cybertec.at>
References: <SA0PR19MB425585C98C339C35A4A5343AA4D50@SA0PR19MB4255.namprd19.prod.outlook.com> <63b750ab4d35937cc1abe75387ce39050c2dc8f0.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox