X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D73E2D818E for ; Fri, 21 Oct 2005 06:57:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60190-10 for ; Fri, 21 Oct 2005 09:57:10 +0000 (GMT) Received: from xor.sigaev.ru (xor.sai.msu.ru [212.192.243.97]) by svr1.postgresql.org (Postfix) with ESMTP id C13BFD7960 for ; Fri, 21 Oct 2005 06:57:11 -0300 (ADT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by xor.sigaev.ru (Postfix) with ESMTP id AF22D1700F; Fri, 21 Oct 2005 13:57:12 +0400 (MSD) Message-ID: <4358BB78.5050303@sigaev.ru> Date: Fri, 21 Oct 2005 13:57:12 +0400 From: Teodor Sigaev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20050927 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Michael Fuhr , pgsql-docs@postgresql.org, Oleg Bartunov Subject: Re: Multicolumn index doc out of date? References: <20050912142647.GA34685@winnie.fuhr.org> <23966.1126553464@sss.pgh.pa.us> <4326BBF5.4090900@sigaev.ru> <15864.1129854901@sss.pgh.pa.us> In-Reply-To: <15864.1129854901@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.084 required=5 tests=[AWL=0.034, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/64 X-Sequence-Number: 3309 Tom Lane wrote: > [ getting back to this documentation issue finally ] > > Teodor Sigaev writes: > >>I disagree with last affirmation: inner pages of index contains fair union of >>keys and enough helpful to select. Mailware ( http://www.pgsql.ru/db/mw ) >>sucsessfully use combined GiST index (date, tsvector) for searching. > > >>GiST's split algorithm is good for unique leading keys, not so bad for small >>number of non-unique values and bad for all equals leading key. But "bad" means >>that itsn't optimal as picksplit for other keys may be. If there is several keys >>which can be moved on left or right page without changing union of first key for >>each page then GiST try put its on page (left or right) with smallest penalty >>calculated by other keys. This algorithm is very similar to defining page to put >>tuple with normal processing (without page split). > > >>With unique leading key GiST's split is fully similar to BTree - it looks only >>at leading key, but gistchoose isn't. Gistchoose (gistutil.c:622) chooses child >>with smallest penalty and it looks to other keys if several leading keys has the >>same penalty. In a GiST tree different keys may have the same penalty value with >>new key. > > > OK, how about this text then? > > A multicolumn GiST index can only be used when there is a query condition > on its leading column. Conditions on additional columns restrict the > entries returned by the index, but the condition on the first column is the > most important one for determining how much of the index needs to be > scanned. A GiST index will be relatively ineffective if its first column > has only a few distinct values, even if there are many distinct values in > additional columns. Ok, I think. -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/