Re: pageinspect: Hash index support

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Cc: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pageinspect: Hash index support
Date: 2017-01-23 10:17:36
Message-ID: CAA4eK1JEaUzifpvaRPMjB9waisdLR+TjD3pu0QW+QpFxW=Q1tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 18, 2017 at 3:24 PM, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
>
>> 4.
>> +Datum
>> +hash_page_items(PG_FUNCTION_ARGS)
>> +{
>> + bytea *raw_page = PG_GETARG_BYTEA_P(0);
>>
>>
>> +Datum
>> +hash_bitmap_info(PG_FUNCTION_ARGS)
>> +{
>> + Oid indexRelid = PG_GETARG_OID(0);
>> + uint32 ovflblkno = PG_GETARG_UINT32(1);
>>
>> Is there a reason for keeping the input arguments for
>> hash_bitmap_info() different from hash_page_items()?
>>
>
> Yes, there are two reasons behind it.
>
> Firstly, we need metapage to identify the bitmap page that holds the
> information about the overflow page passed as an input to this
> function.
>

Okay, for that probably index oid is sufficient.

> Secondly, we will have to input overflow block number as an input to
> this function so as to determine the overflow bit number which can be
> used further to identify the bitmap page.
>

I think you can get that from bucket number by using BUCKET_TO_BLKNO.
You can get bucket number from page's opaque data. So, if we follow
that then you can have a prototype of a function as
hash_bitmap_info(index_oid, page bytea) which will be quite similar to
other API's exposed by this module.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-01-23 10:25:32 Re: Declarative partitioning vs. BulkInsertState
Previous Message Etsuro Fujita 2017-01-23 10:11:46 Odd plan shown in src/backend/optimizer/README