Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VraDa-0005z4-DP for pgsql-admin@arkaria.postgresql.org; Fri, 13 Dec 2013 21:24:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VraDZ-0006cD-FM for pgsql-admin@arkaria.postgresql.org; Fri, 13 Dec 2013 21:24:17 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VraDY-0006c6-Ar for pgsql-admin@postgresql.org; Fri, 13 Dec 2013 21:24:16 +0000 Received: from nm32-vm0.bullet.mail.bf1.yahoo.com ([72.30.239.136]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VraDU-0000MK-F2 for pgsql-admin@postgresql.org; Fri, 13 Dec 2013 21:24:15 +0000 Received: from [98.139.212.152] by nm32.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 21:24:11 -0000 Received: from [98.139.212.244] by tm9.bullet.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 21:24:11 -0000 Received: from [127.0.0.1] by omp1053.mail.bf1.yahoo.com with NNFMP; 13 Dec 2013 21:24:10 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 991202.30437.bm@omp1053.mail.bf1.yahoo.com Received: (qmail 11765 invoked by uid 60001); 13 Dec 2013 21:24:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1386969850; bh=6MRvG4OiwiQRMujEtxb+EkLg/+I2iOZLFGJopTkP1K8=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Te5vOpUVBBLWQPu2rtDRhF1rfS1G5n1MOT19qBWSkM9RFu6pnHaEmvlDiWf5CugZE1/roXR4/9K/aaHiT57OF1eB8apCMnAmg4gb8C835gMl774groxoTYx4Gm9ozbQ9PF22bshR77h6AVt2vfiYFcgiqUcSGxqwtJeQVdgybyo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=IU21nspvTa3fDQh3Zt2oCXfUwnaF3EgsW7esr6eNx+AHmd50FNucA1EqtJHw2lgKjmQ8qM1xp+kmRzUGCNv7QK4C6dLwqgjTDaqtFtWZDmYcdzKFOBriprMsHIXAKc+4tnJupIVw9UbYEaoQNb/ESz/UBo/xqCrkaoGmLetLn30=; X-YMail-OSG: v2Y_Qm4VM1kFpcQX7tWrqHX3iS3EC0SyfOICaNLnbpoF_p7 4Z42U1Bz_AMpJPQWDDdw095CJOLsBM8FqoKHuRIihNtM5Xhp_53vGLJ1.nb8 YQyrcQax38PRT9pcz48xZnCz0CEY8SAZ5vjcrzn1_IdDtA1RGMBZftUmDua_ OjgAohObTR4XtLYUxOBvexysrVIWcNCZq2rEiwf7MopNbMfBHd8o5F7j6s9t ASdc7AlBmP0KVhPfaZ0R5_DQgFutYXnfU07VcvYiuc_M1j.n56gG.HiTXGyo 8shqwq1YrNgux4h_9xz2faUGuy307t.NY6TqMM.X_u6G7I0aB9HWJKaSHdcg HzxXs63ZKlxGbaCoKwaWcOvcstK52j7nQe4_QG37s7huRSPYdwVkNswDIijt 3pFCOKGyL2aPGD8vbX6HwjBpPT829W5jj4PKHDgE1b9iPe4IQmnhcEAfTgj9 4AZK.zRUKLWISAZw.UrLZudnuqkvRdqWFNxiwJbp2qM2j8CpGWDC7varmif9 SSGDDzFTWKNK5DnJ7mRjMniQutJuxh1BPks8IhFzGKEWhqCC3VBaHAgIEMN1 6ThHtSLlqviJebCJGyDCoE_8knMb7U.sHQgYbD2.zAJ7GTlhlf7cYg40FYGK afrowL4SBJCt457S8pVhgjicqD5eZugZZ3XQARDrKUbgRugzXAmXlGk5gFcB gSQg- Received: from [76.255.18.237] by web162903.mail.bf1.yahoo.com via HTTP; Fri, 13 Dec 2013 13:24:10 PST X-Rocket-MIMEInfo: 002.001, SmVuaSBGaWZyaWNrIDxqZmlmcmlja0BpbmNvbW0uY29tPiB3cm90ZToKCj4gSXMgaXQgbm9ybWFsIGZvciB2YWN1bW0gdG8gcnVuIHRoYXQgbG9uZyAoMjMgaG91cik_CgpJdCBjYW4gYmUuwqAgVGhlIGF1dG92YWN1dW0gd29ya2VycyBhcmUgInBhY2VkIiBzbyB0aGF0IHRoZWlyCnJlc291cmNlIHVzYWdlIGlzIGxpbWl0ZWQuwqAgVGhpcyBzcHJlYWRzIG91dCB0aGUgd29yaywgdG8gbWluaW1pemUKaW1wYWN0IG9uIGZvcmVncm91bmQgcHJvY2Vzc2VzLsKgIEluIHNvbWUgY2FzZXMgdGhlIGRlZmF1bHQKY28BMAEBAQE- X-Mailer: YahooMailWebService/0.8.169.609 References: Message-ID: <1386969850.61933.YahooMailNeo@web162903.mail.bf1.yahoo.com> Date: Fri, 13 Dec 2013 13:24:10 -0800 (PST) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: AUTOVACUUM after purging a lot of records To: Jeni Fifrick , "pgsql-admin@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Jeni Fifrick wrote: > Is it normal for vacumm to run that long (23 hour)? It can be.=C2=A0 The autovacuum workers are "paced" so that their resource usage is limited.=C2=A0 This spreads out the work, to minimize impact on foreground processes.=C2=A0 In some cases the default configuration is not aggressive enough to keep up overall, but that should be what you look at, not whether a particular worker takes days on a particular table -- that in itself doesn't indicate a problem. > Is there a way to verify whether the vacuum process is running > properly and making any progress? Use OS tools (like top or ps) to check whether the process is still consuming resources. > Can I increase the maintenance_work_mem parameter to make the > existing process faster? That is one of many settings which are often tuned.=C2=A0 If you really want to cause that table to finish quickly, you could just start a VACUUM ANALYZE command for that table.=C2=A0 The autovacuum run will cancel to make room for it, and the command default to running full speed rather than pacing its work.=C2=A0 You could set maintenance_work_mem or cost-based pacing for the command in the session before running the command to optimize it or pace it. > Do you think it=E2=80=99s better to do VACUUM FULL, consider the amount > of records deleted? That depends on how much data is left and whether you can afford to have the table exclusively locked while its data is copied and re-indexed. > Any other input/recommendation you can give us? If you expect to purge sets of data like that, and you know what purge group a row belongs in at the time it is inserted, you should probably look at partitioning.=C2=A0 There's no faster way to drop millions of rows from a table than to drop the partition they are in. > We=E2=80=99re using Vpostgres version 9.1.3 If you want to stay with 9.1 for now, you should upgrade to the latest minor release. http://www.postgresql.org/support/versioning/ > on CentOS 6.3. 12 cores and 64 GB memory. > But, we=E2=80=99re using default setup. With a machine that size, you definitely should tune several settings.=C2=A0 The defaults are geared more toward being able to "install and go" on a low-end laptop.=C2=A0 Serious servers need tuning. If you really are at the default configuration (including max_connections), the following would almost certainly be improvements: shared_buffers =3D 8GB effective_cache_size =3D 32GB work_mem =3D 160MB maintenance_work_mem =3D 2GB wal_buffers =3D 32MB checkpoint_completion_target =3D 0.9 checkpoint_segments =3D 64 autovacuum_vacuum_cost_limit =3D 800 cpu_tuple_cost =3D 0.03 Depending on the size of your active data set, you may also want to reduce random_page_cost; but you didn't provide enough information to know that.=C2=A0 That's hardly a complete list, but it should help with performance on most servers and workloads with the RAM and cores you describe. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin