On 19.04.2017 11:42, Ashutosh Bapat wrote:
> On Tue, Apr 18, 2017 at 4:43 PM, Maksim Milyutin
> <m.milyutin@postgrespro.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