From: CSS <css@morefoo.com>
To: pgsql-performance@postgresql.org
Subject: select operations that generate disk writes
Date: Fri, 6 Jul 2012 02:10:36 -0400
Message-ID: <C6B622D6-5DE1-48FB-BF8B-2C8065FEA346@morefoo.com> (raw)
Hello,
Time for a broad question. I'm aware of some specific select queries that will generate disk writes - for example, a sort operation when there's not enough work_mem can cause PG to write out some temp tables (not the correct terminology?). That scenario is easily remedied by enabling "log_temp_files" and specifying the threshold in temp file size at which you want logging to happen.
I've recently been trying to put some of my recent reading of Greg's book and other performance-related documentation to use by seeking out queries that take an inordinate amount of time to run. Given that we're usually disk-bound, I've gotten in the habit of running an iostat in a terminal while running and tweaking some of the problem queries. I find this gives me some nice instant feedback on how hard the query is causing PG to hit the disks. What's currently puzzling me are some selects with complex joins and sorts that generate some fairly large bursts of write activity while they run. I was able to reduce this by increasing work_mem (client-side) to give the sorts an opportunity to happen in memory. I now see no temp file writes being logged, and indeed the query sped up.
So my question is, what else can generate writes when doing read-only operations? I know it sounds like a simple question, but I'm just not finding a concise answer anywhere.
Thanks,
Charles
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-performance@postgresql.org
Cc: css@morefoo.com
Subject: Re: select operations that generate disk writes
In-Reply-To: <C6B622D6-5DE1-48FB-BF8B-2C8065FEA346@morefoo.com>
References: <C6B622D6-5DE1-48FB-BF8B-2C8065FEA346@morefoo.com>
* 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