From: Robert Leach <rleach@princeton.edu>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18177: certain queries under certain contexts take multiple orders of magnitude longer compared to v10
Date: Mon, 6 Nov 2023 13:22:52 -0500
Message-ID: <BDBE80B4-8F45-4501-B261-CDC140B0CFD9@princeton.edu> (raw)
In-Reply-To: <CAApHDvqdPv9RV6G+Ua5S6ADpR1U7vuEtGV_7COvLXnnrbv8OXw@mail.gmail.com>
References: <18177-a282c2eaaf791f21@postgresql.org>
<CAApHDvrRgDpV19MDNZ-0Tou-F2+cTU6ZNPq3rixUGp_kuw6-9Q@mail.gmail.com>
<76BDCC62-0333-41A8-95E5-40B7A8C3D698@princeton.edu>
<CAApHDvqdPv9RV6G+Ua5S6ADpR1U7vuEtGV_7COvLXnnrbv8OXw@mail.gmail.com>
> Perhaps more aggressive autovacuum settings could help, but we've not gotten far enough to tell yet.
Well, I can report that changing the autovacuum settings does indeed help. I added this to all of the `setUpClass` methods of our test code:
ALTER TABLE "DataRepo_peakdata" SET (autovacuum_vacuum_scale_factor = 0.0);
ALTER TABLE "DataRepo_peakdata" SET (autovacuum_vacuum_threshold = 5000);
ALTER TABLE "DataRepo_peakdata" SET (autovacuum_analyze_scale_factor = 0.0);
ALTER TABLE "DataRepo_peakdata" SET (autovacuum_analyze_threshold = 5000);
The one query I've been testing with reproducibly runs in a fraction of a second and when I run the entire test suite on github, it runs in 33 minutes as opposed to an hour, which is close to on par with how it was running in postgres 10.
It's also notable that I have not been able to get this speed improvement using a `VACUUM FULL ANALYZE`, though I can't be sure I ever did it correctly in the first place.
The above was based on the feedback you guys provided and the following blog post:
https://www.lob.com/blog/supercharge-your-postgresql-performance
I still don't like the fact that we have this database-architecture-specific code in our code-base that ties it to a specific database. I'm not sure if where I put it is the best place for it either. Is there a config file I can put these settings in?
And I'm still curious why this wasn't necessary in postgres 10?
Rob
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-bugs@postgresql.org
Cc: rleach@princeton.edu
Subject: Re: BUG #18177: certain queries under certain contexts take multiple orders of magnitude longer compared to v10
In-Reply-To: <BDBE80B4-8F45-4501-B261-CDC140B0CFD9@princeton.edu>
References: <18177-a282c2eaaf791f21@postgresql.org> <CAApHDvrRgDpV19MDNZ-0Tou-F2+cTU6ZNPq3rixUGp_kuw6-9Q@mail.gmail.com> <76BDCC62-0333-41A8-95E5-40B7A8C3D698@princeton.edu> <CAApHDvqdPv9RV6G+Ua5S6ADpR1U7vuEtGV_7COvLXnnrbv8OXw@mail.gmail.com> <BDBE80B4-8F45-4501-B261-CDC140B0CFD9@princeton.edu>
* 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