pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15679: Partial HASH index takes too much space
2+ messages / 2 participants
[nested] [flat]
* BUG #15679: Partial HASH index takes too much space
@ 2019-03-08 20:06 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2019-03-08 20:06 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: gentz@futuretap.com
The following bug has been logged on the website:
Bug reference: 15679
Logged by: Ortwin Gentz
Email address: gentz@futuretap.com
PostgreSQL version: 10.6
Operating system: Amazon RDS
Description:
I created a partial HASH index for a sparsely populated column:
CREATE INDEX partial_hash ON mytable USING HASH(my_id) WHERE my_ID IS NOT
NULL;
Even though the my_id VARCHAR(255) column is populated (NON NULL) only for a
few hundred records, the index takes 256 MB of space (for a table with > 10m
records). Also, it doesn't make a difference if the index is created as a
partial index ("WHERE my_ID IS NOT NULL") or as a full index.
In contrast to that, a BTREE index differs considerably in space for full
and partial:
CREATE INDEX full_btree ON mytable (my_id); # 543 MB
CREATE INDEX partial_btree ON mytable (my_id) WHERE my_ID IS NOT NULL; # 16
KB
See also this StackExchange conversation where user jjanes considers the
behavior a bug in the hash index code:
https://dba.stackexchange.com/a/231660/25337
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15679: Partial HASH index takes too much space
@ 2019-03-11 09:23 David Rowley <david.rowley@2ndquadrant.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: David Rowley @ 2019-03-11 09:23 UTC (permalink / raw)
To: gentz@futuretap.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Sat, 9 Mar 2019 at 09:38, PG Bug reporting form
<noreply@postgresql.org> wrote:
> I created a partial HASH index for a sparsely populated column:
>
> CREATE INDEX partial_hash ON mytable USING HASH(my_id) WHERE my_ID IS NOT
> NULL;
>
> Even though the my_id VARCHAR(255) column is populated (NON NULL) only for a
> few hundred records, the index takes 256 MB of space (for a table with > 10m
> records). Also, it doesn't make a difference if the index is created as a
> partial index ("WHERE my_ID IS NOT NULL") or as a full index.
>
> In contrast to that, a BTREE index differs considerably in space for full
> and partial:
>
> CREATE INDEX full_btree ON mytable (my_id); # 543 MB
> CREATE INDEX partial_btree ON mytable (my_id) WHERE my_ID IS NOT NULL; # 16
> KB
Thanks for the report. This issue is being discussed over in
https://www.postgresql.org/message-id/flat/CAMkU%3D1x0k%2BdRQHDUgp4BjFeSgxyLBBXyKNY5Pt1Yu6YHB0mhKA%4...
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-03-11 09:23 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 20:06 BUG #15679: Partial HASH index takes too much space PG Bug reporting form <noreply@postgresql.org>
2019-03-11 09:23 ` David Rowley <david.rowley@2ndquadrant.com>
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