Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E3483633EEB for ; Fri, 19 Mar 2010 17:20:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 24984-03 for ; Fri, 19 Mar 2010 20:20:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.25]) by mail.postgresql.org (Postfix) with ESMTP id 73D5D633837 for ; Fri, 19 Mar 2010 17:20:41 -0300 (ADT) Received: by ey-out-2122.google.com with SMTP id d26so235814eyd.33 for ; Fri, 19 Mar 2010 13:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=IwdC8NDU0a9pzXRwwt909nUxPgorrNQlNuSnQhydY2s=; b=lwjjHZQIGCgkXbw6yggTjdOI0MI6D1KvFQ7MApy4A+rIBs67NlxeNF+3Gg5lNHZhM9 zAJFQiGdkPWdj+mjGPuj8NpVRQUM3PQDcaI1hzKnETcWNKFUZ66E+/7NLv/bgTRQg4EQ mXP2XDUbpb1goT4Fdl+a8/70Rvp35EF/LPNqc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=OO7ok1Crzsk5OORjTa/q5nTQEzxVPqaKV9i7dLQ9+H5UTH7vH6fckqBwaP2IMmP3qB jwjGd/2KP74ab28QMG3aL4rQnAQxwhd8kDeRwbH/bHaFZzhYAWf/3SiqHccYBhpFjlmE AEl6lIjjKEOUwSwpjJx5CA6kW8KV4AZ2vkgUU= Received: by 10.213.0.212 with SMTP id 20mr739437ebc.41.1269030039453; Fri, 19 Mar 2010 13:20:39 -0700 (PDT) Received: from [0.0.0.0] (5357DA75.cable.casema.nl [83.87.218.117]) by mx.google.com with ESMTPS id 14sm629601ewy.10.2010.03.19.13.20.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Mar 2010 13:20:38 -0700 (PDT) Message-ID: <4BA3DCA1.2010808@gmail.com> Date: Fri, 19 Mar 2010 21:20:49 +0100 From: Yeb Havinga User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Matthew Wakeling CC: Bruce Momjian , pgsql-performance@postgresql.org Subject: Re: GiST index performance References: <201002252342.o1PNgtG07127@momjian.us> <4B9FAF4B.20907@gmail.com> <4BA0A036.1070508@gmail.com> <4BA3A6C6.80406@gmail.com> In-Reply-To: <4BA3A6C6.80406@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.381 tagged_above=-10 required=5 tests=AWL=0.218, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/247 X-Sequence-Number: 38072 Yeb Havinga wrote: >>>>> Matthew Wakeling wrote: >>>>>> A second quite distinct issue is the general performance of GiST >>>>>> indexes >>>>>> which is also mentioned in the old thread linked from Open Items. >>>>>> For >>>>>> that, we have a test case at >>>>>> http://archives.postgresql.org/pgsql-performance/2009-04/msg00276.php >>>>>> for >>>>>> btree_gist indexes. I have a similar example with the bioseg GiST >>>>>> index. I >>>>>> have completely reimplemented the same algorithms in Java for >>>>>> algorithm >>>>>> investigation and instrumentation purposes, and it runs about a >>>>>> hundred >>>>>> times faster than in Postgres. I think this is a problem, and I'm >>>>>> willing >>>>>> to do some investigation to try and solve it. More gist performance.. Some background: I've been involved in developing several datatypes that make use of gist indexes (we just published a paper on it, see http://arxiv.org/abs/1003.3370), that's the main reason I'm very much interested in possible improvements in gist index speed. One of the datatypes was 'very badly' indexable: non leaf pages were getting very general keys, so in the end we could see from the scanning times compared to sequential scans that the whole index was being scanned. One thing I remember was the idea that somehow it would be nice if the dept of the gist tree could be fiddled with: in that case keys of non leaf nodes would be more specific again. In the original Guttman R-tree paper there was mention of a parameter that determined the size of entries in nodes and thereby indirectly the depth of the tree. I missed that in the PostgreSQL gist api. One thing Gist scanning does very often is key comparisons. So another approach is to try to limit those and again this might be possible by increasing the depth / decrease number of entries per page. I just did a test where in gistfitpage the gistpagesize was divided by 5 and something similar in gistnospace. Scantime before adjustment: about 70 seconds. After adjustment: 45 seconds. With gist_stat from the gevel package confirmed that the depth was now 4 (original 3). Drawback: bigger index size because pages are not filled completely anymore. The explain shows (actual time=0.030..0.032) for the inner loop times, which is less then half of the original scan time. Since the gistpagesize is derived from the database blocksize, it might be wise to set the blocksize low for this case, I'm going to play with this a bit more. regards, Yeb Havinga