From: Erik Wienhold <ewie@ewie.name>
To: Richard Brockie <richard.brockie@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Slow down dev database transactions/second for testing?
Date: Mon, 6 Feb 2023 00:05:29 +0100 (CET)
Message-ID: <1186356122.107942.1675638329216@office.mailbox.org> (raw)
In-Reply-To: <CAKv-vOUCaGTedS==EXe-OVM_bMkcBqq5y28_Ps7FKxedpGVkXw@mail.gmail.com>
References: <CAKv-vOUCaGTedS==EXe-OVM_bMkcBqq5y28_Ps7FKxedpGVkXw@mail.gmail.com>
> On 05/02/2023 23:17 CET Richard Brockie <richard.brockie@gmail.com> wrote:
>
> I maintain a Django webapp that uses postgresql and can create inefficient
> queries if I'm not careful. I'm looking for ways to mimic a congested db
> server in development to expose these queries.
pgbench is what your looking for: https://www.postgresql.org/docs/current/pgbench.html
You can run custom statements with the --file option. Get the statements that
Django generates and let pgbench run those to analyze the bottlenecks. Or let
pgbench create load for some time (see option --time) while you debug your
Django app.
> The configuration of postgresql is complicated - is there a simple method by
> which I could, for example limit the number of transactions/second to a
> certain level by adjusting postgresql.conf?
No. Postgres will execute as fast as possible with the available resources.
--
Erik
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: ewie@ewie.name, richard.brockie@gmail.com
Subject: Re: Slow down dev database transactions/second for testing?
In-Reply-To: <1186356122.107942.1675638329216@office.mailbox.org>
References: <CAKv-vOUCaGTedS==EXe-OVM_bMkcBqq5y28_Ps7FKxedpGVkXw@mail.gmail.com> <1186356122.107942.1675638329216@office.mailbox.org>
* 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