Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vdkly-00045J-4w for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Nov 2013 17:50:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vdklx-0004hx-LM for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Nov 2013 17:50:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vdklw-0004ho-QS for pgsql-hackers@postgresql.org; Tue, 05 Nov 2013 17:50:36 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vdkll-0003Ph-7y for pgsql-hackers@postgresql.org; Tue, 05 Nov 2013 17:50:36 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id B2A6F9A508; Tue, 5 Nov 2013 09:49:26 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id A46AB40380; Tue, 5 Nov 2013 09:49:26 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id AAF95C005E; Tue, 5 Nov 2013 09:49:40 -0800 (PST) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Tue, 5 Nov 2013 09:49:39 -0800 (PST) Message-ID: <52792FA4.3010508@vmware.com> Date: Tue, 05 Nov 2013 19:49:24 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: Alexander Korotkov CC: Tomas Vondra , pgsql-hackers Subject: Re: GIN improvements part 1: additional information References: <51CEA13C.8040103@vmware.com> <524E7C3B.7060402@vmware.com> <5250A7A1.2010701@fuzzy.cz> <52546434.1000303@vmware.com> <52548F79.6030407@fuzzy.cz> <52569635.5090808@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -6.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 On 04.11.2013 23:44, Alexander Korotkov wrote: > On Mon, Oct 21, 2013 at 11:12 PM, Alexander Korotkov > wrote: > >> Attached version of patch is debugged. I would like to note that number of >> bugs was low and it wasn't very hard to debug. I've rerun tests on it. You >> can see that numbers are improved as the result of your refactoring. >> >> event | period >> -----------------------+----------------- >> index_build | 00:01:45.416822 >> index_build_recovery | 00:00:06 >> index_update | 00:05:17.263606 >> index_update_recovery | 00:01:22 >> search_new | 00:24:07.706482 >> search_updated | 00:26:25.364494 >> (6 rows) >> >> label | blocks_mark >> ----------------+------------- >> search_new | 847587636 >> search_updated | 881210486 >> (2 rows) >> >> label | size >> ---------------+----------- >> new | 419299328 >> after_updates | 715915264 >> (2 rows) >> >> Beside simple bugs, there was a subtle bug in incremental item indexes >> update. I've added some more comments including ASCII picture about how >> item indexes are shifted. >> >> Now, I'm trying to implement support of old page format. Then we can >> decide which approach to use. >> > > Attached version of patch has support of old page format. Patch still needs > more documentation and probably refactoring, but I believe idea is clear > and it can be reviewed. In the patch I have to revert change of null > category placement for compatibility with old posting list format. Thanks, just glanced at this quickly. If I'm reading the patch correctly, old-style non-compressed posting tree leaf pages are not vacuumed at all; that's clearly not right. I argued earlier that we don't need to handle the case that compressing a page makes it larger, so that the existing items don't fit on the page anymore. I'm having some second thoughts on that; I didn't take into account the fact that the "mini-index" in the new page format takes up some space. I think it's still highly unlikely that there isn't enough space on a 8k page, but it's not totally crazy with a non-standard small page size. So at least that situation needs to be checked for with an ereport(), rather than Assert. To handle splitting a non-compressed page, it seems that you're relying on the fact that before splitting, we try to insert, which compresses the page. The problem with that is that it's not correctly WAL-logged. The split record that follows includes a full copy of both page halves, but if the split fails for some reason, e.g you run out of disk space, there is no WAL record at all of the the compression. I'd suggest doing the compression in the insert phase on a temporary copy of the page, leaving the original page untouched if there isn't enough space for the insertion to complete. (You could argue that this case can't happen because the compression must always create enough space to insert one more item. maybe so, but at least there should be an explicit check for that.) - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers