Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YoJqv-00042G-3I for pgsql-hackers@arkaria.postgresql.org; Fri, 01 May 2015 22:56:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YoJqu-0003Mf-JT for pgsql-hackers@arkaria.postgresql.org; Fri, 01 May 2015 22:56:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YoJqs-0003MW-FB for pgsql-hackers@postgresql.org; Fri, 01 May 2015 22:56:10 +0000 Received: from mail-by2on0068.outbound.protection.outlook.com ([207.46.100.68] helo=na01-by2-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1YoJqo-0003wA-R4 for pgsql-hackers@postgresql.org; Fri, 01 May 2015 22:56:09 +0000 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; Received: from decina.local (70.113.16.71) by BLUPR11MB0674.namprd11.prod.outlook.com (25.163.216.144) with Microsoft SMTP Server (TLS) id 15.1.154.19; Fri, 1 May 2015 22:55:57 +0000 Message-ID: <55440474.4080507@BlueTreble.com> Date: Fri, 1 May 2015 17:55:48 -0500 From: Jim Nasby User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Robert Haas , Simon Riggs CC: Amit Kapila , Petr Jelinek , Andres Freund , Heikki Linnakangas , Bruce Momjian , Sawada Masahiko , Greg Stark , PostgreSQL-development , Jeff Janes Subject: Re: Reducing tuple overhead References: <20150423162429.GG3055@alap3.anarazel.de> <553921B1.7080204@2ndquadrant.com> <5539491C.6040405@BlueTreble.com> <553AA753.9010103@BlueTreble.com> In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [70.113.16.71] X-ClientProxiedBy: DM2PR10CA0043.namprd10.prod.outlook.com (10.141.241.11) To BLUPR11MB0674.namprd11.prod.outlook.com (25.163.216.144) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR11MB0674; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BLUPR11MB0674; BCL:0; PCL:0; RULEID:; SRVR:BLUPR11MB0674; X-Forefront-PRVS: 0563F2E8B7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(479174004)(24454002)(377454003)(65806001)(47776003)(117636001)(1720100001)(92566002)(77156002)(2950100001)(66066001)(65956001)(15395725005)(76176999)(50986999)(54356999)(86362001)(19580405001)(23676002)(19580395003)(83506001)(5001920100001)(46102003)(50466002)(64126003)(4001350100001)(87976001)(62966003)(65816999)(99136001)(42186005)(15975445007)(122386002)(5001770100001)(36756003)(5001960100002)(93886004)(62816006)(85282002)(18886065003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR11MB0674; H:decina.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2015 22:55:57.2187 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR11MB0674 X-Pg-Spam-Score: -2.1 (--) 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 On 4/30/15 7:37 AM, Robert Haas wrote: > On Thu, Apr 30, 2015 at 8:05 AM, Simon Riggs wrote: >> A much better idea is to work out how to avoid index bloat at cause. If we >> are running an UPDATE and we cannot get a cleanup lock, we give up and do a >> non-HOT update, causing the index to bloat. It seems better to wait for a >> short period to see if we can get the cleanup lock. The short period is >> currently 0, so lets start there and vary the duration of wait upwards >> proportionally as the index gets more bloated. That only happens if there already wasn't enough space on the page so we need to Defrag, yes? If there is enough space we can HOT update without the cleanup lock. What would be useful to know is how often we abort a HOT update because of lack of free space; that would indicate to a DBA that a lower fill factor may be in oredr. What would be useful to -hackers would be stats on how often an update would have been HOT if only the page had been pruned. > What I'd be worried about there is that it would be very hard to tune > the wait time, and that the operating system scheduling granularity > (10ms?) would be way too long. [1] indicates between 0.75 and 6ms by default on Linux. I think FBSD still uses a 1000Hz scheduler (1ms), but it's not as clear. What might be more promising is ways to avoid holding a pin for a long time (like the outer side of a nested loop), or being more aggressive about attempting the lock (IE: lower the threshold to trigger cleaning). There's also a (in hindsight) questionable bit of logic in heap_page_prune_opt(); once we get the cleanup lock we check the page free space a second time. If we managed to actually get the lock, we should probably just clean it anyway. > But I'm in vigorous agreement with you on one point: the solution to > index bloat (and probably heap bloat, too) is not to clean it up > faster but to create less of it in the first place. Making more > updates HOT is one way to do that. +1. 1: http://stackoverflow.com/questions/16401294/how-to-know-linux-scheduler-time-slice -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers