From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Christoph Berg <myon@debian.org>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Surjective functional indexes
Date: Wed, 28 Mar 2018 10:18:38 +0300
Message-ID: <a1962a84-70aa-939d-9a1e-63b954ed3727@postgrespro.ru> (raw)
In-Reply-To: <CANP8+j+R6UWVsqwwOJoK5Vb1HaoxDD0gigKueSKRpwadUvbiFQ@mail.gmail.com>
References: <20180322203743.reucnyd7pelkkxom@alvherre.pgsql>
<32bb7b6e-b138-9a7c-e74b-7af1365ec4ee@postgrespro.ru>
<CANP8+jLLZvG+MDhnXsiv4Hxbh4wcOWRkC6Zu=PGg63gOFwuyyw@mail.gmail.com>
<CANP8+j+R6UWVsqwwOJoK5Vb1HaoxDD0gigKueSKRpwadUvbiFQ@mail.gmail.com>
On 27.03.2018 22:08, Simon Riggs wrote:
> On 23 March 2018 at 15:54, Simon Riggs <simon@2ndquadrant.com> wrote:
>
>> So please could you make the change?
> Committed, but I still think that change would be good.
>
Thank you.
But I still not sure whether replacement of bitmap with List or array of
Oids is really good idea.
There are two aspects: size and speed. It seems to me that memory
overhead is most important.
At least you rejected your own idea about using autotune for this
parameters because of presence of extra 16 bytes in statistic.
But RelationData structure is even more space critical: its size is
multiplied by number of relations and backends.
Bitmap seems to provide the most compact representation of the
projective index list.
Concerning speed aspect, certainly iteration through the list of all
indexes with checking presence of index in the bitmap is more expensive
than just direct iteration through Oid
list or array. But since check of bitmap can be done in constant time,
both approaches have the same complexity. Also for typical case (< 5
normal indexes for a table and 1-2 functional indexes)
difference in performance can not be measured.
Also bitmap provides convenient interface for adding new members. To
construct array of Oids I need first to determine number of indexes, so
I have to perform two loops.
So if you and Alvaro insist on this change, then I will definitely do
it. But from my point of view, using bitmap here is acceptable solution.
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: k.knizhnik@postgrespro.ru, simon@2ndquadrant.com, alvherre@alvh.no-ip.org, sfrost@snowman.net, michael.paquier@gmail.com, myon@debian.org, thomas.munro@enterprisedb.com, peter.eisentraut@2ndquadrant.com
Subject: Re: [HACKERS] Surjective functional indexes
In-Reply-To: <a1962a84-70aa-939d-9a1e-63b954ed3727@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox