Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YQyMh-0004NJ-1W for pgsql-performance@arkaria.postgresql.org; Thu, 26 Feb 2015 13:20:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YQyMf-0002W0-3V for pgsql-performance@arkaria.postgresql.org; Thu, 26 Feb 2015 13:20:29 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YQyMd-0002Vp-O9 for pgsql-performance@postgresql.org; Thu, 26 Feb 2015 13:20:27 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YQyMV-00026J-Nj for pgsql-performance@postgresql.org; Thu, 26 Feb 2015 13:20:25 +0000 Received: from comserver.tbz-pariv.de ([194.113.71.71]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0M6DsI-1Xc0ZQ0VDu-00y5Uw for ; Thu, 26 Feb 2015 14:20:14 +0100 Received: from localhost (localhost [127.0.0.1]) by comserver.tbz-pariv.de (Postfix) with ESMTP id 1783C215C5 for ; Thu, 26 Feb 2015 14:20:12 +0100 (CET) X-Virus-Scanned: amavisd-new at tbz-pariv.de Received: from comserver.tbz-pariv.de ([127.0.0.1]) by localhost (comserver.tbz-pariv.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NbdmZyhn6xdM for ; Thu, 26 Feb 2015 14:20:09 +0100 (CET) Received: from [172.17.6.169] (apsrkunze.tbz-pariv.lan [172.17.6.169]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by comserver.tbz-pariv.de (Postfix) with ESMTPSA id 287CC212A2 for ; Thu, 26 Feb 2015 14:20:08 +0100 (CET) Message-ID: <54EF1DB0.3060304@tbz-pariv.de> Date: Thu, 26 Feb 2015 14:20:48 +0100 From: "Sven R. Kunze" Organization: TBZ-PARIV GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Reverse Key Index References: <54DF9036.8080502@tbz-pariv.de> <7978.1423937899@sss.pgh.pa.us> <54DF9559.8080109@tbz-pariv.de> <54EE4D45.1060704@agliodbs.com> <54EEFDA1.7020609@tbz-pariv.de> <54EF1045.5040609@tbz-pariv.de> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:scVmfoyjeCaDPKVvUJyhanHyCoizrIAlpVa1yAulEBT0paLm7gr K4w6ssXWkK9gDMrRainDlKSgUZfya7IBMo57Isc+WTOBi/582T12zRzfrWb0uZDQH2SvGFn RXrsE3Nwg8tJcJHb4SkafkGzx6XoUa4ajyCwqDIsauWOKA6PMZTDrlabwIc/Km+biURpwAb /wviGySnv5pgXk3e7kthw== X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 26.02.2015 13:48, Thomas Kellerer wrote: > Sven R. Kunze schrieb am 26.02.2015 um 13:23: >> If you think Reverse Key Indexes have no usage here in PostgreSQL, you s= hould not support convenience features >> for easily improving performance without breaking the querying API Sorry for my bad English: The if-clause ends with "just let me know and=20 we can close the issue immediately." You quoted an or'ed if-part. Point was, if you see no benefits or you have no intention to include it=20 anyway (patch provided or not), we can stop now. I am not married to=20 this features and right now I can live without it. > It's also unclear to me which "performance" you are referring to. > Insert performance? Retrieval performance? Concurrency? > > The use-case for reverse indexes in Oracle is pretty small: it's _only_ a= bout the contention when doing a lot of inserts with increasing numbers (be= cause the different transactions will be blocked when accessing the blocks = in question). Exactly. That would include logging databases and big/high-frequency=20 OLTP systems. > As Postgres manages inserts differently than Oracle I'm not so sure that = this problem exists in Postgres the same way it does in Oracle. Maybe, PostgreSQL internal experts can answer that question thoroughly. > That's why I asked if you have a _specific_ problem. I see. Answering explicitly: no, I don't. > Richard Footes blog post is mostly about the myth that _if_ you have a re= verse index this is only used for equality operations. > It does not claim that a reverse index is faster than a regular index _if= _ it is used for a range scan. Correct. > The question is: do you think you need a reverse index because you have a= performance problem with when doing many, many inserts at the same time us= ing "close-by" values into a table that uses a btree index on the column? I presume that Oracle would not invest resources in implementing=20 features which would have no benefits for their customers. Thus, the=20 research on this topic should already been done for us. That given, if we can answer your question 'whether PostgreSQL handles=20 it differently from Oracle so that the contention issue cannot arise'=20 can be answered with a no, I tend to say: yes. > Or do you think you need a reverse index to improve the performance of a = range scan? If that is the then you can easily us a gin/gist index or even = a simple btree index using a trigram index to speed up a "LIKE '%abc%'" (so= mething Oracle can't do at all) without having to worry about obfuscation l= ayers (aka ORM). From what I gather, reverse key indexes are not about improving range=20 scans but about improving insertion speed due to diversification of=20 insertion location. I actually used Richard Foote's posts only to get a proper understanding=20 of reverse key indexes and what can and cannot be done with them and=20 where their issues are: https://richardfoote.wordpress.com/2008/01/14/introduction-to-reverse-key-i= ndexes-part-i/ https://richardfoote.wordpress.com/2008/01/16/introduction-to-reverse-key-i= ndexes-part-ii-another-myth-bites-the-dust/ https://richardfoote.wordpress.com/2008/01/18/introduction-to-reverse-key-i= ndexes-part-iii-a-space-oddity/ https://richardfoote.wordpress.com/2008/01/21/introduction-to-reverse-key-i= ndexes-part-iv-cluster-one/ --=20 Sven R. Kunze TBZ-PARIV GmbH, Bernsdorfer Str. 210-212, 09126 Chemnitz Tel: +49 (0)371 33714721, Fax: +49 (0)371 5347920 e-mail: srkunze@tbz-pariv.de web: www.tbz-pariv.de Gesch=C3=A4ftsf=C3=BChrer: Dr. Reiner Wohlgemuth Sitz der Gesellschaft: Chemnitz Registergericht: Chemnitz HRB 8543 --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance