Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezPNV-00084T-DS for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Mar 2018 16:17:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezPNU-0006ot-9P for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Mar 2018 16:17:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezPNU-0006ng-29 for pgsql-hackers@lists.postgresql.org; Fri, 23 Mar 2018 16:17:16 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezPNL-0003ey-Hx for pgsql-hackers@postgresql.org; Fri, 23 Mar 2018 16:17:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4177621C4F55; Fri, 23 Mar 2018 19:17:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id DE2F721C4ED8; Fri, 23 Mar 2018 19:17:03 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1521821824; bh=E/DwOTyNEEkdTbhRAHi1mxsLSslgWSlfsh9186E1ii4=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=M/O61aFakPp2jjlt+soMzskMdyWHnDmF2+OO+0vrrZRscdQ5nzvEIvcieZm9esBbo EWHQjOWhC5Jdt/SXneSxptd7DINgG9NhsntLLoEU8SmArCiE6dkNueMwEuUm2mdpIZ rKtVBhgo/oaQkg+5UcGnH0tIYCfgqTGlDhC56TDc= Subject: Re: [HACKERS] Surjective functional indexes To: Alvaro Herrera Cc: Stephen Frost , Michael Paquier , Simon Riggs , Christoph Berg , Thomas Munro , Peter Eisentraut , PostgreSQL Hackers References: <20180323154534.4c3s3kdjil6hktyp@alvherre.pgsql> From: Konstantin Knizhnik Message-ID: Date: Fri, 23 Mar 2018 19:17:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180323154534.4c3s3kdjil6hktyp@alvherre.pgsql> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 23.03.2018 18:45, Alvaro Herrera wrote: > Konstantin Knizhnik wrote: > >> rd_projidx is not a list, it is Bitmapset. It is just one of many bitmap >> sets in RelationData: > Yes, but the other bitmapsets are of AttrNumber of the involved column. > They new one is of list_nth() counters for items in the index list. > That seems weird and it scares me -- do we use that coding pattern > elsewhere? Maybe use an array of OIDs instead? > Using list or array instead of bitmap requires much more space... And bitmaps are much more efficient for many operations: check for element presence, combine, intersect,... Check in bitmap has O(0) complexity so iterating through list of all indexes or attributes with bitmap check doesn't add any essential overhead. Sorry, I do not understand this: "They new one is of list_nth() counters for items in the index list" -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company