Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XMVki-00086R-Dr for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2014 05:26:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XMVkh-0005DV-Tw for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2014 05:26:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XMVkg-0005DN-Iw for pgsql-hackers@postgresql.org; Wed, 27 Aug 2014 05:26:34 +0000 Received: from mail.catalyst.net.nz ([2404:130:0:10::40:0]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XMVkb-0000J3-SL for pgsql-hackers@postgresql.org; Wed, 27 Aug 2014 05:26:33 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id BB2403212A; Wed, 27 Aug 2014 17:26:24 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BZZ31hqIFNYP; Wed, 27 Aug 2014 17:26:22 +1200 (NZST) Received: from [192.168.1.64] (122-62-5-20.jetstream.xtra.co.nz [122.62.5.20]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id A1C6A31DA1; Wed, 27 Aug 2014 17:26:22 +1200 (NZST) Message-ID: <53FD6BFE.40601@catalyst.net.nz> Date: Wed, 27 Aug 2014 17:26:22 +1200 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alvaro Herrera CC: Amit Kapila , Haribabu Kommi , "pgsql-hackers@postgresql.org" Subject: Re: Per table autovacuum vacuum cost limit behaviour strange References: <20140214213227.GF6342@eldon.alvh.no-ip.org> <53672F63.3080400@catalyst.net.nz> <53686F22.8030300@catalyst.net.nz> <20140826161911.GE6343@eldon.alvh.no-ip.org> <20140826222700.GA23139@eldon.alvh.no-ip.org> In-Reply-To: <20140826222700.GA23139@eldon.alvh.no-ip.org> Content-Type: multipart/mixed; boundary="------------010204090100050307090808" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------010204090100050307090808 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 27/08/14 10:27, Alvaro Herrera wrote: > Alvaro Herrera wrote: > >> So my proposal is a bit more complicated. First we introduce the notion >> of a single number, to enable sorting and computations: the "delay >> equivalent", which is the cost_limit divided by cost_delay. > > Here's a patch that implements this idea. As you see this is quite a > bit more complicated that Haribabu's proposal. > > There are two holes in this: > > 1. if you ALTER DATABASE to change vacuum delay for a database, those > values are not considered in the global equiv delay. I don't think this > is very important and anyway we haven't considered this very much, so > it's okay if we don't handle it. > > 2. If you have a "fast worker" that's only slightly faster than regular > workers, it will become slower in some cases. This is explained in a > FIXME comment in the patch. > > I don't really have any more time to invest in this, but I would like to > see it in 9.4. Mark, would you test this? Haribabu, how open are you > to fixing point (2) above? > I did some testing with this patch applied. Minimally tweaking autovacuum (naptime of 5s) with a single table 'cache0' created with a cost limit setting of 10000, running: $ pgbench -n -c8 -T300 -f volatile0.sql cache and monitoring the size of 'cache0' table showed a steady state of: cache=# SELECT pg_relation_size('cache0')/(1024*1024) AS mb; mb ------ 85 So far so good. Adding another table 'cache1' similar to the previous but lacking any per table autovacuum settings, and running 2 pgbench sessions: $ pgbench -n -c8 -T300 -f volatile0.sql cache $ pgbench -n -c8 -T300 -f volatile1.sql cache (volatile1.sql just uses table 'cache1' instead of 'cache0') shows after a few minutes: cache=# SELECT relname,pg_relation_size(oid)/(1024*1024) AS mb FROM pg_class WHERE relname like 'cache_'; relname | mb ---------+-------- cache0 | 664 cache1 | 1900 So we are definitely seeing the 'fast' worker being slowed down. Also, the growth of 'cache1' was only a bit faster than 'cache0' - so the 'slow' worker was getting a speed boost was well. So looks like good progress, but yeah - point (2) is obviously rearing its head in this test. Cheers Mark --------------010204090100050307090808 Content-Type: application/sql; name="schema.sql" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="schema.sql" Q1JFQVRFIFRBQkxFIGNhY2hlMChpZCBTRVJJQUwgUFJJTUFSWSBLRVksIHZh bCBURVhUKSAKV0lUSCAoYXV0b3ZhY3V1bV92YWN1dW1fY29zdF9saW1pdCA9 IDEwMDAwKQo7CgpDUkVBVEUgVEFCTEUgY2FjaGUxKGlkIFNFUklBTCBQUklN QVJZIEtFWSwgdmFsIFRFWFQpIAo7Cg== --------------010204090100050307090808 Content-Type: application/sql; name="volatile0.sql" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="volatile0.sql" QkVHSU47ClxzZXQgbnJvd3MgMTAwCklOU0VSVCBJTlRPIGNhY2hlMCAodmFs KSBTRUxFQ1Qgcy52YWwgRlJPTSAoIFNFTEVDVCBnZW5lcmF0ZV9zZXJpZXMo MSwgOm5yb3dzKSwgJ3h4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4 eHh4eHh4eHh4eHh4eHh4eHh4JyBBUyB2YWwpIEFTIHM7CkRFTEVURSBGUk9N IGNhY2hlMCBXSEVSRSBpZCBJTiAoU0VMRUNUIGlkIEZST00gY2FjaGUwIE9S REVSIEJZIGlkIERFU0MgTElNSVQgOm5yb3dzKTsKQ09NTUlUOwo= --------------010204090100050307090808 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------010204090100050307090808--