Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8fsi-0002ib-Iq for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jan 2014 00:53:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W8fsi-0006zH-2L for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jan 2014 00:53:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8fsg-0006z8-1t for pgsql-hackers@postgresql.org; Thu, 30 Jan 2014 00:53:22 +0000 Received: from mail.gransy.com ([2001:1528:137::f1]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8fsb-0001vi-UX for pgsql-hackers@postgresql.org; Thu, 30 Jan 2014 00:53:20 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id E23E3508D90 for ; Thu, 30 Jan 2014 01:53:08 +0100 (CET) X-Virus-Scanned: G-Hosting.cz + Station.cz + Klenot.cz + Subreg.cz amavisd-new at antispam.gransy.com Received: from mail.gransy.com ([82.208.29.194]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id PJnf8Z-FJ0Cn for ; Thu, 30 Jan 2014 01:53:09 +0100 (CET) Received: from [192.168.1.227] (ip-78-45-139-138.net.upcbroadband.cz [78.45.139.138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: tv@fuzzy.cz) by mail.gransy.com (Postfix) with ESMTPSA id 5E171508D8E for ; Thu, 30 Jan 2014 01:53:08 +0100 (CET) Message-ID: <52E9A274.6040806@fuzzy.cz> Date: Thu, 30 Jan 2014 01:53:08 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: pgsql-hackers@postgresql.org Subject: Re: GIN improvements part2: fast scan References: <51C4ACC5.2090707@vmware.com> <51D00FB6.9030008@vmware.com> <528533D9.3040501@vmware.com> <52E141BA.5000302@vmware.com> <52E4141E.60609@fuzzy.cz> <52E42AD0.5060600@vmware.com> <52E4AA3A.9000607@fuzzy.cz> <52E53458.2010106@vmware.com> <52E72A10.5040908@fuzzy.cz> <52E75C54.9050209@vmware.c om> In-Reply-To: <52E75C54.9050209@vmware.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.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 28.1.2014 08:29, Heikki Linnakangas wrote: > On 01/28/2014 05:54 AM, Tomas Vondra wrote: >> Then I ran those scripts on: >> >> * 9.3 >> * 9.4 with Heikki's patches (9.4-heikki) >> * 9.4 with Heikki's and first patch (9.4-alex-1) >> * 9.4 with Heikki's and both patches (9.4-alex-2) > > It would be good to also test with unpatched 9.4 (ie. git master). The > packed posting lists patch might account for a large part of the > differences between 9.3 and the patched 9.4 versions. > > - Heikki > Hi, the e-mail I sent yesterday apparently did not make it into the list, probably because of the attachments, so I'll just link them this time. I added the results from 9.4 master to the spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0Alm8ruV3ChcgdHJfZTdOY2JBSlkwZjNuWGlIaGM0REE It's a bit cumbersome to analyze though, so I've quickly hacked up a simple jqplot page that allows comparing the results. It's available here: http://www.fuzzy.cz/tmp/gin/ It's likely there are some quirks and issues - let me know about them. The ODT with the data is available here: http://www.fuzzy.cz/tmp/gin/gin-scan-benchmarks.ods Three quick basic observations: (1) The current 9.4 master is consistently better than 9.3 by about 15% on rare words, and up to 30% on common words. See the charts for 6-word queries: http://www.fuzzy.cz/tmp/gin/6-words-rare-94-vs-93.png http://www.fuzzy.cz/tmp/gin/6-words-rare-94-vs-93.png With 3-word queries the effects are even stronger & clearer, especially with the common words. (2) Heikki's patches seem to work OK, i.e. improve the performance, but only with rare words. http://www.fuzzy.cz/tmp/gin/heikki-vs-94-rare.png With 3 words the impact is much stronger than with 6 words, presumably because it depends on how frequent the combination of words is (~ multiplication of probabilities). See http://www.fuzzy.cz/tmp/gin/heikki-vs-94-3-common-words.png http://www.fuzzy.cz/tmp/gin/heikki-vs-94-6-common-words.png for comparison of 9.4 master vs. 9.4+heikki's patches. (3) A file with explain plans for 4 queries suffering ~2x slowdown, and explain plans with 9.4 master and Heikki's patches is available here: http://www.fuzzy.cz/tmp/gin/queries.txt All the queries have 6 common words, and the explain plans look just fine to me - exactly like the plans for other queries. Two things now caught my eye. First some of these queries actually have words repeated - either exactly like "database & database" or in negated form like "!anything & anything". Second, while generating the queries, I use "dumb" frequency, where only exact matches count. I.e. "write != written" etc. But the actual number of hits may be much higher - for example "write" matches exactly just 5% documents, but using @@ it matches more than 20%. I don't know if that's the actual cause though. regards Tomas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers