Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4EJU-0001Gq-Ve for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2014 18:38:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W4EJU-0001p2-Em for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2014 18:38:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4EJS-0001mu-3w for pgsql-hackers@postgresql.org; Fri, 17 Jan 2014 18:38:38 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4EJK-00037C-Ej for pgsql-hackers@postgresql.org; Fri, 17 Jan 2014 18:38:37 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id B296E2890B; Fri, 17 Jan 2014 10:38:26 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 7CD01B015F; Fri, 17 Jan 2014 10:38:26 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id E4470120033; Fri, 17 Jan 2014 10:39:52 -0800 (PST) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Fri, 17 Jan 2014 10:39:51 -0800 (PST) Message-ID: <52D9789E.3030202@vmware.com> Date: Fri, 17 Jan 2014 20:38:22 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: Alexander Korotkov CC: Tomas Vondra , pgsql-hackers Subject: Re: GIN improvements part 1: additional information References: <5298E834.4090408@vmware.com> <52A58AD5.6030808@vmware.com> <52A62771.3070800@vmware.com> <52AEE445.1060206@vmware.com> <52AF837C.3040201@vmware.com> <52B2F5B0.1030809@vmware.com> <52B49C34.8060300@vmware.com> <52D0A947.6050706@fuzzy.cz> <52D478F2.6070005@fuzzy.cz> <52D5E1BC.3000208@fuzzy.cz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.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 On 01/17/2014 01:05 PM, Alexander Korotkov wrote: > Seems to be fixed in the attached version of patch. > Another improvement in this version: only left-most segments and further > are re-encoded. Left part of page are left untouched. I'm looking into this now. A few quick notes: * Even when you don't re-encode the whole page, you still WAL-log the whole page. While correct, it'd be a pretty obvious optimization to only WAL-log the modified part. * When new items are appended to the end of the page so that only the last existing compressed segment is re-encoded, and the page has to be split, the items aren't divided 50/50 on the pages. The loop that moves segments destined for the left page to the right won't move any existing, untouched, segments. > ! /* > ! * Didn't fit uncompressed. We'll have to encode them. Check if both > ! * new items and uncompressed items can be placed starting from last > ! * segment of page. Then re-encode only last segment of page. > ! */ > ! minNewItem = newItems[0]; > ! if (nolduncompressed == 0 && > ! ginCompareItemPointers(&olduncompressed[0], &minNewItem) < 0) > ! minNewItem = olduncompressed[0]; That looks wrong. If I'm understanding it right, it's trying to do minNewItem = Min(newItems[0], olduncompressed[0]). The test should be "nolduncompressed > 0 && ..." No need to send a new patch, I'll just fix those while reviewing... - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers