Unique Restricted Postgres Index Index

If Postgres 10 supports the hash index correctly, I would like to use the hash index to search for id (the hash index is smaller compared to btree and theoretically faster).

I have a table

create table t (id int);
create unique index on t using hash (id);

But I got the following:

ERROR: access method "hash" does not support unique indexes

Why does the hash index not allow a unique restriction? Are there any ways around this?

+4
source share
1 answer

The documentation leaves no room for doubt:

Currently, only B-tree indexes can be declared unique.

A discussion of the list of hackers was recently discussed , and it was concluded that it would not be easy to add the ability to allow hash indexes UNIQUE.

+4

Source: https://habr.com/ru/post/1678209/


All Articles