pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: pgsql-performance@postgresql.org
Subject: Re: new to postgres (and db management) and performance
Date: Tue, 17 Jan 2006 14:52:58 +0100
Message-ID: <43CCF6BA.5010909@logix-tt.com> (raw)
In-Reply-To: <074b01c61b1c$538335e0$6402a8c0@iwing>
References: <43CC1938.7020807@gmail.com>
	<18875.1137451410@sss.pgh.pa.us>
	<070501c61aee$ed450560$6402a8c0@iwing>
	<22960.1137460135@sss.pgh.pa.us>
	<071801c61b05$7ea50c10$6402a8c0@iwing>
	<m3hd83sdyw.fsf@mobile.int.cbbrowne.com>
	<074b01c61b1c$538335e0$6402a8c0@iwing>

Hi, Thomas,

me@alternize.com wrote:
>> Try a), b), and c) in order on the "offending" tables as they address
>> the problem at increasing cost...
> 
> thanks alot for the detailed information! the entire concept of vacuum
> isn't yet that clear to me, so your explanations and hints are very much
> appreciated. i'll defenitely try these steps this weekend when the next
> full vacuum was scheduled :-)

Basically, VACUUM scans the whole table and looks for pages containing
garbage rows (or row versions), deletes the garbage, and adds those
pages to the free space map (if there are free slots). When allocating
new rows / row versions, PostgreSQL first tries to fit them in pages
from the free space maps before allocating new pages. This is why a high
max_fsm_pages setting can help when VACUUM freqency is low.

VACUUM FULL additionally moves rows between pages, trying to concentrate
all the free space at the end of the tables (aka "defragmentation"), so
it can then truncate the files and release the space to the filesystem.

CLUSTER basically rebuilds the tables by copying all rows into a new
table, in index order, and then dropping the old table, which also
reduces fragmentation, but not as strong as VACUUM FULL might.

ANALYZE creates statistics about the distribution of values in a column,
allowing the query optimizer to estimate the selectivity of query criteria.

(This explanation is rather simplified, and ignores indices as well as
the fact that a table can consist of multiple files. Also, I believe
that newer PostgreSQL versions allow VACUUM to truncate files when free
pages happen to appear at the very end of the file.)


HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



view thread (12+ messages)

Message-ID: <43CCF6BA.5010909@logix-tt.com>
Permalink:  ../43CCF6BA.5010909@logix-tt.com/
Also on:    postgresql.org/message-id/43CCF6BA.5010909@logix-tt.com

 · 

reply

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: schabi@logix-tt.com
  Subject: Re: new to postgres (and db management) and performance
  In-Reply-To: <43CCF6BA.5010909@logix-tt.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