Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 905D3B5DBDC for ; Tue, 17 May 2011 10:53:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 93091-08 for ; Tue, 17 May 2011 13:52:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com [209.85.216.174]) by mail.postgresql.org (Postfix) with ESMTP id 463D6B5DBD9 for ; Tue, 17 May 2011 10:52:53 -0300 (ADT) Received: by qyk7 with SMTP id 7so2085622qyk.19 for ; Tue, 17 May 2011 06:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=55Wn21RYgMkPWacCxKJxh6lL34c3rZDayvHcVYU3V0c=; b=upV9t043R4r65v86wBE9mAoHoR0bxz28Lp7EkFsG17C10agFaB9mj1B2RkN7lLlaf9 91Xst76diTBwAc6mVcbKOjazlCbut2JoOw5sk/zfiZi6A2brOtKi2O76fgMbL+YG/reB hasDVWNxj/gfyjcvDowLNG7UZ2u4YLwEfD0BE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=oAgKzSpEQN9S3myZlWJhK6fIR4HUBngp4m5bvagFnaH6nX9JFwm9HHhk6WMbuITR8i iGGjM0KTKrl5iTPxfLWvj+QNBVpLZJJaRsVVNqXZCYN+RYwPBq/rr+AzhzxEmr/iseuV C6VBvC5/uvNu/KpuxDiCGB7v84uX0lkms/mzM= Received: by 10.229.221.140 with SMTP id ic12mr440518qcb.176.1305640373173; Tue, 17 May 2011 06:52:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.226.77 with HTTP; Tue, 17 May 2011 06:52:33 -0700 (PDT) In-Reply-To: References: <003201cc1492$514419a0$f3cc4ce0$@devshock.com> From: =?ISO-8859-1?Q?C=E9dric_Villemain?= Date: Tue, 17 May 2011 15:52:33 +0200 Message-ID: Subject: Re: Fill Factor To: Scott Marlowe Cc: Anibal David Acosta , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/261 X-Sequence-Number: 43770 2011/5/17 Scott Marlowe : > On Tue, May 17, 2011 at 6:59 AM, Anibal David Acosta wr= ote: >> Hello, >> >> How fillfactor impact performance of query? > > Fillfactor tells the db how much empty space to leave in the database > when creating a table and inserting rows. =A0If you set it to 90% then > 10% of the space in the table will be available for updates can be > used for the new data. =A0Combined with pg 8.3+ HOT updates, this free > space allows updates to non-indexed fields to be close to "free" > because now the index for that row needs no updates if the new datum > for that row first in the same 8k pg block. > >> I have two cases, >> One is a operational table, for each insert it have an update, this tabl= e >> must have aprox. 1.000 insert per second and 1.000 update per second (sa= me >> inserted row) > > If you could combine the insert and update into one action that would > be preferable really. > >> Is necessary to change the fill factor? > > Not necessary but possibly better for performance. depend of deletes ratio too... without delete I am unsure a reduced fillfactor will have a good impact on the long term. > >> The other case is a table that have few insert (statistics) but thousand= s or >> millons of update, In this case the fillfactor is not necessary to chang= e? > > Actually updates are the time that a lower fill factor is most useful. > =A0But it doesn't need to be really low. =A0anything below 95% is likely > more than you need. =A0But it really depends on your access patterns. If > you're updating 20% of a table at a time, then a fillfactor of ~80% > might be the best fit. =A0Whether or not the updates fit under the HOT > umbrella, lowering fill factor enough to allow the updates to happen > in place without adding pages to the table files is usually a win. And one possible way to help adjust the fillfactor is to control the relation size. Sometimes reducing fillfactor a lot (60-80%) is good, the table is stuck at some XX MB and page are well reused. > > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org= ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance > --=20 C=E9dric Villemain=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 2ndQuadrant http://2ndQuadrant.fr/=A0 =A0=A0 PostgreSQL : Expertise, Formation et Suppo= rt