public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jeremy Finzel <[email protected]>
To: postgres performance list <[email protected]>
Subject: Odd sudden performance degradation related to temp object churn
Date: Mon, 14 Aug 2017 14:53:48 -0500
Message-ID: <CAMa1XUi6pbugdB7zUA6weoPjmUHTzNLZcSEAh06-7FZRzkuHQw@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-performance>
This particular db is on 9.3.15. Recently we had a serious performance
degradation related to a batch job that creates 4-5 temp tables and 5
indexes. It is a really badly written job but what really confuses us is
that this job has been running for years with no issue remotely approaching
this one. We are also using pgpool.
The job would kick off with 20-30 of similar queries running at once. The
thing normally takes only 30ms or so to run - it only operates on 1
customer at a time (yes, it's horribly written). All of a sudden the
cluster started thrashing and performance seriously degraded. We tried a
number of things with no success:
- Analyzed the whole database
- Turned off full logging
- Turned off synchronous commit
- Vacuumed several of the catalog tables
- Checked if we had an abnormal high amount of traffic this time - we
didn't
- No abnormal disk/network issues (we would have seen much larger issues
if that had been the case)
- Tried turning down the number of app nodes running
What ended up completely resolving the issue was converting the query to
use ctes instead of temp tables. That means we avoided the disk writing
and the catalog churn, and useless indexes. However, we are baffled as to
why this could make such a big difference when we had no issue like this
before, and we have seen no systematic performance degradation in our
system.
Any insights would be greatly appreciated, as we are concerned not knowing
the root cause.
Thanks,
Jeremy
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Odd sudden performance degradation related to temp object churn
In-Reply-To: <CAMa1XUi6pbugdB7zUA6weoPjmUHTzNLZcSEAh06-7FZRzkuHQw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox