Re: range test for hash index?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: range test for hash index?
Date: 2019-09-16 12:28:43
Message-ID: CAA4eK1LzkuHPoDBSoLJMOSYECwoazKqPx8k-s1BEgVkdSzs6mQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 16, 2019 at 7:23 AM Paul A Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> On Sat, Sep 14, 2019 at 5:13 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > In general, the hash_range is covered by some of the existing test,
> > but I don't which test. See the code coverage report here:
> > https://coverage.postgresql.org/src/backend/utils/adt/rangetypes.c.gcov.html
>
> Thanks! I did some experimenting, and the current test code *only*
> calls `hash_range_internal` when we force it like this:
>

I don't see this function on the master branch. Is this function name
correct? Are you looking at some different branch?

> set enable_nestloop=f;
> set enable_hashjoin=t;
> set enable_mergejoin=f;
> select * from numrange_test natural join numrange_test2 order by nr;
>
> But if I create that index as a hash index instead, we also call it
> for these inserts and selects (except for the empty ranges):
>
> create table numrange_test2(nr numrange);
> create index numrange_test2_hash_idx on numrange_test2 (nr);
>
> INSERT INTO numrange_test2 VALUES('[, 5)');
> INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2));
> INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2));
> INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2,'()'));
> INSERT INTO numrange_test2 VALUES('empty');
>
> select * from numrange_test2 where nr = 'empty'::numrange;
> select * from numrange_test2 where nr = numrange(1.1, 2.2);
> select * from numrange_test2 where nr = numrange(1.1, 2.3);
>
> (None of that is surprising, right? :-)
>
> So that seems like more confirmation that it was always intended to be
> a hash index.

Yes, it indicates that.

Jeff/Heikki, to me the issue pointed by Paul looks like an oversight
in commit 4429f6a9e3. Can you think of any other reason? If not, I
can commit this patch.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Glukhov 2019-09-16 12:44:07 Re: Bug in GiST paring heap comparator
Previous Message Peter Bex 2019-09-16 11:32:57 Re: BUG #15383: Join Filter cost estimation problem in 10.5