Re: (9.1) btree_gist support for searching on "not equals"

Поиск
Список
Период
Сортировка
От Takahiro Itagaki
Тема Re: (9.1) btree_gist support for searching on "not equals"
Дата
Msg-id 20100525100322.CF3F.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: (9.1) btree_gist support for searching on "not equals"  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
Список pgsql-hackers
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> wrote:

> On 5/21/10 11:47 PM +0300, Jeff Davis wrote:
> > It also allows you to enforce the constraint that only one tuple exists
> > in a table by doing something like:
> >
> >    create table a
> >    (
> >      i int,
> >      exclude using gist (i with<>),
> >      unique (i)
> >    );

+1.  I've not read the code, but it might be considerable that we can
abort index scans if we find a first index entry for "i". While we must
scan all candidates for "WHERE i <> ?", but we can abort for the constraint
case because we know existing values are all the same.

> FWIW, this is achievable a lot more easily:
> CREATE UNIQUE INDEX "a_single_row" ON a ((1));

The former exclusion constraint means "one same value for all rows",
but your alternative means "a_single_row", right?

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: ExecutorCheckPerms() hook
Следующее
От: KaiGai Kohei
Дата:
Сообщение: Re: ExecutorCheckPerms() hook