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 1ezOmz-0005f1-5r for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Mar 2018 15:39:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezOmx-00082E-Nx for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Mar 2018 15:39:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezOmx-00080H-AN for pgsql-hackers@lists.postgresql.org; Fri, 23 Mar 2018 15:39:31 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezOmt-000713-G2 for pgsql-hackers@postgresql.org; Fri, 23 Mar 2018 15:39:29 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id ACC8821C4CB1; Fri, 23 Mar 2018 18:39:24 +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 4B62121C4C97; Fri, 23 Mar 2018 18:39:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1521819564; bh=JVTreB9V8O4UVL9O1J/og/a97D5c9TT6xv8bpH7NH7U=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=co2Jx7allwpmRzkuIgv66mrFNH3QqArB2DzOk3bgzOvR+MWsPKqJUSlVUQhccLYiD 7rJyDOCDyRamy4XvA1VPpgaf5y3xlv2LNKZ8dBL0TjNl+U/Z6GJlD5IJ0L6CzIRZUT lBxM1p86tgUXptPiihAajq3w8mO04xzpTS8IQ444= 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: <20180322203743.reucnyd7pelkkxom@alvherre.pgsql> From: Konstantin Knizhnik Message-ID: <32bb7b6e-b138-9a7c-e74b-7af1365ec4ee@postgrespro.ru> Date: Fri, 23 Mar 2018 18:39:24 +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: <20180322203743.reucnyd7pelkkxom@alvherre.pgsql> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 22.03.2018 23:37, Alvaro Herrera wrote: > The rd_projidx (list of each nth element in the index list that is a > projection index) thing looks odd. Wouldn't it make more sense to have > a list of index OIDs that are projection indexes? > rd_projidx is not a list, it is Bitmapset. It is just one of many bitmap sets in RelationData:     Bitmapset  *rd_indexattr;    /* identifies columns used in indexes */     Bitmapset  *rd_keyattr;        /* cols that can be ref'd by foreign keys */     Bitmapset  *rd_pkattr;        /* cols included in primary key */     Bitmapset  *rd_idattr;        /* included in replica identity index */ Yes, it is possible to construct Oid list of projectional indexes instead of having bitmap which marks some indexes in projectional, but I am not sure that it will be more efficient both from CPU and memory footprint point of view (in most indexes bitmap will consists of just one integer). In any case, I do not think that it can have some measurable impact on performance or memory size: number of indexes and especially projectional indexes will very rarely exceed 10. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company