From: Bill Moran <wmoran@collaborativefusion.com>
To: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: Laurent Raufaste *EXTERN* <analogue@glop.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: PG writes a lot to the disk
Date: Thu, 20 Mar 2008 10:58:33 -0400
Message-ID: <20080320105833.c539476d.wmoran@collaborativefusion.com> (raw)
In-Reply-To: <D960CB61B694CF459DCFB4B0128514C201E66F9E@exadv11.host.magwien.gv.at>
References: <669dc9710803190418g45002e87k19cb742579c1eeac@mail.gmail.com>
<669dc9710803200348x64122249jd2ac5924d78a6da0@mail.gmail.com>
<D960CB61B694CF459DCFB4B0128514C201E66F9E@exadv11.host.magwien.gv.at>
In response to "Albe Laurenz" <laurenz.albe@wien.gv.at>:
> Laurent Raufaste wrote:
> > The problem was that the optimiser didn't know how to run the queries
> > well and used millions of tuples for simple queries. For each tuple
> > used it was updating some bit in the table file, resulting in a huge
> > writing activity to that file.
>
> Good that you solved your problem.
>
> PostgreSQL doesn't write into the table files when it SELECTs data.
>
> Without an EXPLAIN plan it is impossible to say what PostgreSQL
> was doing, but most likely it was building a large hash structure
> or something similar and had to dump data into temporary files.
As a parting comment on this topic ...
Based on his previous messages, he was able to definitively tie
filesystem write activity to specific tables, but also claimed that
his PG logs showed only SELECT statements being executed.
However, the part I wanted to comment on (and got busy yesterday so
am only getting to it now) is that there's no guarantee that SELECT
isn't modifying rows.
SELECT nextval('some_seq');
is the simplest example I can imagine of a select that modifies database
data, but it's hardly the only one. I suspect that the OP has procedures
in his SELECTs that are modifying table data, or triggers that do it ON
SELECT or something similar.
Of course, without any details, this is purely speculation.
--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/
wmoran@collaborativefusion.com
Phone: 412-422-3463x4023
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: pgsql-performance@postgresql.org
Cc: wmoran@collaborativefusion.com, laurenz.albe@wien.gv.at, analogue@glop.org
Subject: Re: PG writes a lot to the disk
In-Reply-To: <20080320105833.c539476d.wmoran@collaborativefusion.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