Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVhsF-0000Xn-Hc for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2016 16:21:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bVhsF-0007tm-4J for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2016 16:21:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bVhqs-0003uy-3t for pgsql-hackers@postgresql.org; Fri, 05 Aug 2016 16:20:02 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVhqi-0005ku-QY for pgsql-hackers@postgresql.org; Fri, 05 Aug 2016 16:20:00 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 6314721C2A28; Fri, 5 Aug 2016 19:19:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d3BRpqqeVUdo; Fri, 5 Aug 2016 19:19:50 +0300 (MSK) Received: from [192.168.27.79] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id AFFB421C2A27; Fri, 5 Aug 2016 19:19:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1470413989; bh=3WHWIB1z4+2kYmeQvxJ0KMeVkAzFMiDQNzWJjOMGFi4=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=ncbhyii9laDqECHQ5YXPihDbt+1ct7ZlITmKuQKHxzHXKBaXVB2zHBJh0kL6pRimd 4GeQieE0JKxpYyiqwgnNLxNX0k0jTZb+UeM5JZP5zFDlMVSu6W0ssyMz5UlPVyNd7b OTZiaoDpmQIA3hHUWD+FS2gRfNYF4p/JhoH6eolY= Subject: Re: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC] To: amborodin@acm.org, Alvaro Herrera References: <20160725015209.GA240901@alvherre.pgsql> Cc: Michael Paquier , Amit Kapila , Alexander Korotkov , pgsql-hackers , Oleg Bartunov , Heikki Linnakangas , Sergey Mirvoda From: Anastasia Lubennikova Message-ID: Date: Fri, 5 Aug 2016 19:19:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.2 (---) 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 30.07.2016 14:00, Andrew Borodin: > Here is BRIN-compatible version of patch. Now function > PageIndexTupleOverwrite consumes tuple size as a parameter, this > behavior is coherent with PageAddItem. > Also, i had to remove asserstion that item has a storage in the loop > that adjusts line pointers. It would be great if someone could check > that place (commented Assert(ItemIdHasStorage(ii)); in > PageIndexTupleOverwrite). I suspect that there might be a case when > linp's should not be adjusted. Hi, I reviewed the code and I have couple of questions about following code: /* may have negative size here if new tuple is larger */ size_diff = oldsize - alignednewsize; offset = ItemIdGetOffset(tupid); if (offset < phdr->pd_upper || (offset + size_diff) > phdr->pd_special || offset != MAXALIGN(offset) || size_diff != MAXALIGN(size_diff)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg("corrupted item offset: offset = %u, size = %u", offset, (unsigned int) size_diff))); First of all, shouldn't we use MAXALIGN(oldsize) instead of oldsize? Although, I'm quite sure that it was already aligned somewhere before. I doubt that the check (size_diff != MAXALIGN(size_diff)) is necessary. I'd rather add the check: (offset+size_diff < pd_lower). Besides that moment, the patch seems pretty good. BTW, I'm very surprised that it improves performance so much. And also size is reduced significantly. 89MB against 289MB without patch. Could you explain in details, why does it happen? -- Anastasia Lubennikova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers