Skip site navigation (1) Skip section navigation (2)

Re: PG writes a lot to the disk

From: Bill Moran <wmoran(at)collaborativefusion(dot)com>
To: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "Laurent Raufaste *EXTERN*" <analogue(at)glop(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: PG writes a lot to the disk
Date: 2008-03-20 14:58:33
Message-ID: 20080320105833.c539476d.wmoran@collaborativefusion.com (view raw or flat)
Thread:
Lists: pgsql-performance
In response to "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)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(at)collaborativefusion(dot)com
Phone: 412-422-3463x4023

In response to

Responses

pgsql-performance by date

Next:From: Tom LaneDate: 2008-03-20 15:20:39
Subject: Re: PG writes a lot to the disk
Previous:From: Albe LaurenzDate: 2008-03-20 14:38:34
Subject: Re: PG writes a lot to the disk

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group