Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAOn6-0004ai-Ej for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2014 19:02:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WAOn5-0001xx-Tn for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2014 19:02:43 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAOn4-0001wV-Ct for pgsql-hackers@postgresql.org; Mon, 03 Feb 2014 19:02:42 +0000 Received: from mail.gransy.com ([2001:1528:137::f1]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WAOn0-0004l6-Vv for pgsql-hackers@postgresql.org; Mon, 03 Feb 2014 19:02:41 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id A4C9A508D5C for ; Mon, 3 Feb 2014 20:02:36 +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 RmyXdsSQoxdE for ; Mon, 3 Feb 2014 20:02:47 +0100 (CET) Received: from sq.gransy.com (elizabeth.gransy.com [89.187.132.199]) (Authenticated sender: tv@fuzzy.cz) by mail.gransy.com (Postfix) with ESMTPA id 891E3508D54; Mon, 3 Feb 2014 20:02:34 +0100 (CET) Received: from 212.47.19.46 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Mon, 3 Feb 2014 20:02:31 +0100 Message-ID: In-Reply-To: References: <528533D9.3040501@vmware.com> <52E141BA.5000302@vmware.com> <52E4141E.60609@fuzzy.cz> <52E42AD0.5060600@vmware.com> <52E4AA3A.9000607@fuzzy.cz> <52E53458.2010106@vmware.com> <07ed535f7ee700a6c5b36e2d9d2d27b6.squirrel@sq.gransy.com> <368f0edae6c56767e78da2e45eb43a93.squirrel@sq.gransy.com> Date: Mon, 3 Feb 2014 20:02:31 +0100 Subject: Re: GIN improvements part2: fast scan From: "Tomas Vondra" To: "Alexander Korotkov" Cc: "Tomas Vondra" , "pgsql-hackers" , "Heikki Linnakangas" User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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 3 Únor 2014, 19:18, Alexander Korotkov wrote: > On Mon, Feb 3, 2014 at 8:19 PM, Tomas Vondra wrote: > >> > > Sometimes test cases are not what we expect. For example: >> >> > >> >> > =# explain SELECT id FROM messages WHERE body_tsvector @@ >> >> > to_tsquery('english','(5alpha1-initdb''d)'); >> >> > QUERY PLAN >> >> > >> >> > >> >> >> ──────────────────────────────────────────────────────────────────────────────── >> >> > Bitmap Heap Scan on messages (cost=84.00..88.01 rows=1 width=4) >> >> > Recheck Cond: (body_tsvector @@ '''5alpha1-initdb'' & >> ''5alpha1'' & >> >> > ''initdb'' & ''d'''::tsquery) >> >> > -> Bitmap Index Scan on messages_body_tsvector_idx >> >> (cost=0.00..84.00 >> >> > rows=1 width=0) >> >> > Index Cond: (body_tsvector @@ '''5alpha1-initdb'' & >> >> ''5alpha1'' >> >> & >> >> > ''initdb'' & ''d'''::tsquery) >> >> > Planning time: 0.257 ms >> >> > (5 rows) >> >> > >> >> > 5alpha1-initdb'd is 3 gin entries with different frequencies. >> >> >> >> Why do you find that strange? The way the query is formed or the way >> >> it's >> >> evaluated? >> >> >> >> The query generator certainly is not perfect, so it may produce some >> >> strange queries. >> >> >> > >> > I just mean that in this case 3 words doesn't mean 3 gin entries. >> >> Isn't that expected? I mean, that's what to_tsquery may do, right? >> > > Everything is absolutely correct. :-) It just may be not what do you > expect > if you aren't getting into details. Well, that's not how I designed the benchmark. I haven't based the benchmark on GIN entries, but on 'natural' words, to simulate real queries. I understand using GIN terms might get "more consistent" results (e.g. 3 GIN terms with given frequency) than the current approach. However this was partially a goal, to cover wider range of cases. Also, that's why the benchmark works with relative speedup - comparing the query duration with and without the patch. Tomas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers