Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOo4r-0004sN-7K for pgsql-general@arkaria.postgresql.org; Sun, 05 Feb 2023 23:05:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pOo4p-0008IC-2P for pgsql-general@arkaria.postgresql.org; Sun, 05 Feb 2023 23:05:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOo4o-0008I3-Eu for pgsql-general@lists.postgresql.org; Sun, 05 Feb 2023 23:05:38 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOo4l-0006mt-Ta for pgsql-general@lists.postgresql.org; Sun, 05 Feb 2023 23:05:37 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4P94k23ylbz9sRw; Mon, 6 Feb 2023 00:05:30 +0100 (CET) Date: Mon, 6 Feb 2023 00:05:29 +0100 (CET) From: Erik Wienhold To: Richard Brockie , pgsql-general@lists.postgresql.org Message-ID: <1186356122.107942.1675638329216@office.mailbox.org> In-Reply-To: References: Subject: Re: Slow down dev database transactions/second for testing? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4P94k23ylbz9sRw List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 05/02/2023 23:17 CET Richard Brockie 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