RE: Wrong value in metapage of GIN INDEX.

imai.yoshikazu@fujitsu.com <imai.yoshikazu@fujitsu.com>

From: "imai.yoshikazu@fujitsu.com" <imai.yoshikazu@fujitsu.com>
To: "'Moon, Insung'" <tsukiwamoon.pgsql@gmail.com>
Cc: "keisuke.kuroda.3862@gmail.com" <keisuke.kuroda.3862@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2019-10-08T06:46:10Z
Lists: pgsql-hackers
Moon-san, kuroda.keisuke-san

On Thu, Aug 29, 2019 at 8:20 AM, Moon, Insung wrote:
> =# CREATE INDEX foo_idx ON foo USING gin (i jsonb_ops);
> =# SELECT * FROM gin_metapage_info(get_raw_page('foo_idx', 0)) WITH (fastupdate=off);

This is not important thing but some mistakes are here.

=# CREATE INDEX foo_idx ON foo USING gin (i jsonb_ops) WITH (fastupdate=off);
=# SELECT * FROM gin_metapage_info(get_raw_page('foo_idx', 0));


> In this example, the nentries value should be 10001 because the gin index stores duplicate values in one leaf(posting
> tree or posting list).
...
> The patch is very simple.
> Fix to increase the value of nEntries only when a non-duplicate GIN index leaf added.

Does nentries show the number of entries in the leaf pages?
If so, the fix seems to be correct.

--
Yoshikazu Imai

Commits

  1. Fix ginEntryInsert's counting of GIN leaf tuples.