Re: Proposal: Local indexes for partitioned table

From: Maksim Milyutin <m(dot)milyutin(at)postgrespro(dot)ru>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Local indexes for partitioned table
Date: 2017-04-19 09:25:56
Message-ID: ce94a69b-6e6e-5369-8d7b-8ebaad2e4b7a@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19.04.2017 11:42, Ashutosh Bapat wrote:
> On Tue, Apr 18, 2017 at 4:43 PM, Maksim Milyutin
> <m(dot)milyutin(at)postgrespro(dot)ru> wrote:
>>
>> Local partitioned indexes can be recognized through the check on the relkind
>> of table to which the index refers. Something like this:
>>
>> heap = relation_open(IndexGetRelation(indexid, false), heapLockmode);
>> if (heap->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
>> /* indexid is local index on partitioned table */
>
> An index on partitioned table can be global index (yet to be
> implemented) or a local index. We can not differentiate between those
> just by looking at the relation on which they are built.
>

We could to refine the criteria for the local partitioned index later
encapsulating it in a macro, e.g., adding a new flag from pg_index that
differentiate the type of index on partitioned table.

>> Thеsе cases must be caught. But as much as partitioned tables doesn't
>> participate in query plans their indexes are unaccessible by executor.
>> Reindex operation is overloaded with my patch.
>>
>
> A global index would have storage for a partitioned table whereas a
> local index wouldn't have any storage for a partitioned table.
>
> I agree with Amit that we need new relkinds for local as well as global indexes.
>

Ok, thanks for the feedback. Then I'll use a new relkind for local
partitioned index in further development.

--
Maksim Milyutin
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2017-04-19 09:37:25 Re: Logical replication ApplyContext bloat
Previous Message Petr Jelinek 2017-04-19 08:59:00 Re: some review comments on logical rep code