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

Lists: pgsql-hackers
From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-07-12 08:17:01
Message-ID: AANLkTikK9IxuZOqDLaW0o2OEc56WgNt-eIAU9f6vUD3r@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

(1) Exclusion constraints support for operators where "x <operator> x"
is false (tiny patch)
https://commitfest.postgresql.org/action/patch_view?id=307
(2) btree_gist support for searching on <> ("not equals")
https://commitfest.postgresql.org/action/patch_view?id=308

Those patches should be committed at once because (2) requires (1) to work
with EXCLUDE constraints. Also, (1) has no benefits without (2) because we
have no use cases for <> as an index-able operator. Both patches are very
simple and small, and worked as expected both "WHERE <>" and EXCLUDE
constraints cases.

I'd like to ask you to write additional documentation about btree_gist [1]
that the module will be more useful when it is used with exclusion
constraints together. Without documentation, no users find the usages.
Of course the docs can be postponed if you have a plan to write docs
when PERIOD types are introduced,
[1] http://developer.postgresql.org/pgdocs/postgres/btree-gist.html

The patch was not applied to 9.0, but the reason was just "no time to test" [2].
We have enough time to test for 9.1, so we can apply it now!
[2] http://archives.postgresql.org/pgsql-hackers/2010-05/msg01874.php

--
Itagaki Takahiro


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-07-16 05:19:16
Message-ID: 1279257556.861.10.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Thank you for the review.

On Mon, 2010-07-12 at 17:17 +0900, Itagaki Takahiro wrote:
> (1) Exclusion constraints support for operators where "x <operator> x"
> is false (tiny patch)
> https://commitfest.postgresql.org/action/patch_view?id=307
> (2) btree_gist support for searching on <> ("not equals")
> https://commitfest.postgresql.org/action/patch_view?id=308
>
> Those patches should be committed at once because (2) requires (1) to work
> with EXCLUDE constraints. Also, (1) has no benefits without (2) because we
> have no use cases for <> as an index-able operator. Both patches are very
> simple and small, and worked as expected both "WHERE <>" and EXCLUDE
> constraints cases.

It appears that Tom already committed (1).

> I'd like to ask you to write additional documentation about btree_gist [1]
> that the module will be more useful when it is used with exclusion
> constraints together. Without documentation, no users find the usages.

Good idea, new patch attached.

Regards,
Jeff Davis

Attachment Content-Type Size
btree-gist-ne-20100715.patch text/x-patch 9.2 KB

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-07-20 07:50:14
Message-ID: AANLkTikJPs09YMYK-hkLfMwMcTdwbnostxRfI55nq_Ru@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/7/16 Jeff Davis <pgsql(at)j-davis(dot)com>:
>> I'd like to ask you to write additional documentation about btree_gist [1]
>> that the module will be more useful when it is used with exclusion
>> constraints together. Without documentation, no users find the usages.

| Example using an Exclusion Constraint to enforce the constraint
| that a cage at a zoo can contain only one kind of animal:

Very interesting example :-)
The patch will be applied immediately.

--
Itagaki Takahiro


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-02 01:57:14
Message-ID: AANLkTikbM3KiiUb-QRNsf7MdUHv0oWw-fVPfLA0oSry0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jul 16, 2010 at 1:19 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> Thank you for the review.
>
> On Mon, 2010-07-12 at 17:17 +0900, Itagaki Takahiro wrote:
>> (1) Exclusion constraints support for operators where "x <operator> x"
>> is false (tiny patch)
>> https://commitfest.postgresql.org/action/patch_view?id=307
>> (2) btree_gist support for searching on <> ("not equals")
>> https://commitfest.postgresql.org/action/patch_view?id=308
>>
>> Those patches should be committed at once because (2) requires (1) to work
>> with EXCLUDE constraints. Also, (1) has no benefits without (2) because we
>> have no use cases for <> as an index-able operator. Both patches are very
>> simple and small, and worked as expected both "WHERE <>" and EXCLUDE
>> constraints cases.
>
> It appears that Tom already committed (1).
>
>> I'd like to ask you to write additional documentation about btree_gist [1]
>> that the module will be more useful when it is used with exclusion
>> constraints together. Without documentation, no users find the usages.
>
> Good idea, new patch attached.

It seems pretty odd to define a constant called
BTNotEqualStrategyNumber in contrib/btree_gist. Shouldn't we either
call this something else, or define it in access/skey.h? Considering
that there seem to be some interesting gymnastics being done with
BTMaxStrategyNumber, I'd vote for the former. Maybe just
BtreeGistNotEqualStrategyNumber?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-02 06:39:36
Message-ID: 1280731176.20551.139.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, 2010-08-01 at 21:57 -0400, Robert Haas wrote:
> On Fri, Jul 16, 2010 at 1:19 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> > Thank you for the review.
> >
> > On Mon, 2010-07-12 at 17:17 +0900, Itagaki Takahiro wrote:
> >> (1) Exclusion constraints support for operators where "x <operator> x"
> >> is false (tiny patch)
> >> https://commitfest.postgresql.org/action/patch_view?id=307
> >> (2) btree_gist support for searching on <> ("not equals")
> >> https://commitfest.postgresql.org/action/patch_view?id=308
> >>
> >> Those patches should be committed at once because (2) requires (1) to work
> >> with EXCLUDE constraints. Also, (1) has no benefits without (2) because we
> >> have no use cases for <> as an index-able operator. Both patches are very
> >> simple and small, and worked as expected both "WHERE <>" and EXCLUDE
> >> constraints cases.
> >
> > It appears that Tom already committed (1).
> >
> >> I'd like to ask you to write additional documentation about btree_gist [1]
> >> that the module will be more useful when it is used with exclusion
> >> constraints together. Without documentation, no users find the usages.
> >
> > Good idea, new patch attached.
>
> It seems pretty odd to define a constant called
> BTNotEqualStrategyNumber in contrib/btree_gist. Shouldn't we either
> call this something else, or define it in access/skey.h? Considering
> that there seem to be some interesting gymnastics being done with
> BTMaxStrategyNumber, I'd vote for the former. Maybe just
> BtreeGistNotEqualStrategyNumber?

Sounds good to me.

At some point we may be interested to add this to BTree, as well. But we
can cross that bridge when we come to it.

Regards,
Jeff Davis


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-02 16:27:46
Message-ID: AANLkTimvcgZqoch2RPY3tDu9rVzLrhePuoKG9mw_ADOY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 2, 2010 at 2:39 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Sun, 2010-08-01 at 21:57 -0400, Robert Haas wrote:
>> On Fri, Jul 16, 2010 at 1:19 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>> > Thank you for the review.
>> >
>> > On Mon, 2010-07-12 at 17:17 +0900, Itagaki Takahiro wrote:
>> >> (1) Exclusion constraints support for operators where "x <operator> x"
>> >> is false (tiny patch)
>> >> https://commitfest.postgresql.org/action/patch_view?id=307
>> >> (2) btree_gist support for searching on <> ("not equals")
>> >> https://commitfest.postgresql.org/action/patch_view?id=308
>> >>
>> >> Those patches should be committed at once because (2) requires (1) to work
>> >> with EXCLUDE constraints. Also, (1) has no benefits without (2) because we
>> >> have no use cases for <> as an index-able operator. Both patches are very
>> >> simple and small, and worked as expected both "WHERE <>" and EXCLUDE
>> >> constraints cases.
>> >
>> > It appears that Tom already committed (1).
>> >
>> >> I'd like to ask you to write additional documentation about btree_gist [1]
>> >> that the module will be more useful when it is used with exclusion
>> >> constraints together. Without documentation, no users find the usages.
>> >
>> > Good idea, new patch attached.
>>
>> It seems pretty odd to define a constant called
>> BTNotEqualStrategyNumber in contrib/btree_gist.  Shouldn't we either
>> call this something else, or define it in access/skey.h?  Considering
>> that there seem to be some interesting gymnastics being done with
>> BTMaxStrategyNumber, I'd vote for the former.  Maybe just
>> BtreeGistNotEqualStrategyNumber?
>
> Sounds good to me.

OK, committed that way.

> At some point we may be interested to add this to BTree, as well. But we
> can cross that bridge when we come to it.

Yeah.

I was also wondering if it would be worth adding some additional
regression testing to contrib/btree_gist exercising this new
functionality. Thoughts?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-03 03:16:01
Message-ID: 1280805361.13046.10.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, 2010-08-02 at 12:27 -0400, Robert Haas wrote:
> I was also wondering if it would be worth adding some additional
> regression testing to contrib/btree_gist exercising this new
> functionality. Thoughts?

Sure. I attached two tests.

Regards,
Jeff Davis

Attachment Content-Type Size
btree_gist_test_ne.diff text/x-patch 3.0 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-03 19:16:00
Message-ID: AANLkTikDGEr7p8H7NFAF3Mbi-p5k3M69L+4twPdHoN7t@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 2, 2010 at 11:16 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Mon, 2010-08-02 at 12:27 -0400, Robert Haas wrote:
>> I was also wondering if it would be worth adding some additional
>> regression testing to contrib/btree_gist exercising this new
>> functionality.  Thoughts?
>
> Sure. I attached two tests.

Committed. I renamed the test to "not_equals" rather than "mixed" and
added an "EXPLAIN (COSTS OFF)" in there to verify that the index is
actually being used. (I might have to remove that if it turns out not
to be stable between an index scan and a bitmap index scan, but let's
see what the buildfarm says.)

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-03 19:52:22
Message-ID: 27921.1280865142@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Aug 2, 2010 at 11:16 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>> Sure. I attached two tests.

> Committed.

I see no sign of a commit from here ...

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (9.1) btree_gist support for searching on "not equals"
Date: 2010-08-03 19:53:51
Message-ID: AANLkTikjpgVLW2wV1_+3nPG8__u2inTFCs6sX3kLF=Q7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 3, 2010 at 3:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Aug 2, 2010 at 11:16 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>>> Sure. I attached two tests.
>
>> Committed.
>
> I see no sign of a commit from here ...

Sigh. Forgot to exit my editor.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company