Re: BUG #3965: UNIQUE constraint fails on long column values

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #3965: UNIQUE constraint fails on long column values
Дата
Msg-id 47BBEADA.4090308@enterprisedb.com
обсуждение исходный текст
Ответ на BUG #3965: UNIQUE constraint fails on long column values  ("Juho Saarikko" <juhos@mbnet.fi>)
Ответы Re: BUG #3965: UNIQUE constraint fails on long column values  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-bugs
Juho Saarikko wrote:
> I suggest implementing unique hash indexes and automatically creating one
> (and turning the b-tree index into a non-unique one) when a large value is
> inserted to fix this. Alternatively, fix b-trees so they can handle large
> values; however, a hash index should be far more efficient for this specific
> case, since the size of a hash is independent of pre-hash data size.

The current implementation of hash indexes actually store the whole key,
in addition to the hash, so the size of the hash index is not
independent of the key size. There has been some discussion on revamping
the hash index implementation, and changing that among other things, but
don't hold your breath.

As others have pointed out, CREATE UNIQUE INDEX i ON ((md5(column)) is a
pretty good work-around.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: ITAGAKI Takahiro
Дата:
Сообщение: Re: BUG #3969: pg_ctl cannot detect server startup
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: BUG #3965: UNIQUE constraint fails on long column values