Re: relhassubclass and partitioned indexes
От | Amit Langote |
---|---|
Тема | Re: relhassubclass and partitioned indexes |
Дата | |
Msg-id | 85d50b48-1b59-ae6c-e984-dd0b2926be3c@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: relhassubclass and partitioned indexes (Michael Paquier <michael@paquier.xyz>) |
Ответы |
Re: relhassubclass and partitioned indexes
|
Список | pgsql-hackers |
Thanks for commenting. On 2018/10/19 15:17, Michael Paquier wrote: > On Fri, Oct 19, 2018 at 01:45:03AM -0400, Tom Lane wrote: >> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes: >>> Should relhassubclass be set/reset for partitioned indexes? >> >> Seems like a reasonable idea to me, at least the "set" end of it. >> We don't ever clear relhassubclass for tables, so maybe that's >> not necessary for indexes either. We *do* reset opportunistically during analyze of inheritance parent; the following code in acquire_inherited_sample_rows() can reset it: /* * Check that there's at least one descendant, else fail. This could * happen despite analyze_rel's relhassubclass check, if table once had a * child but no longer does. In that case, we can clear the * relhassubclass field so as not to make the same mistake again later. * (This is safe because we hold ShareUpdateExclusiveLock.) */ if (list_length(tableOIDs) < 2) { /* CCI because we already updated the pg_class row in this command */ CommandCounterIncrement(); SetRelationHasSubclass(RelationGetRelid(onerel), false); ereport(elevel, (errmsg("skipping analyze of \"%s.%s\" inheritance tree --- this inheritance tree contains no child tables", get_namespace_name(RelationGetNamespace(onerel)), RelationGetRelationName(onerel)))); return 0; } Similarly, perhaps we can make REINDEX on a partitioned index reset the flag if it doesn't find any children. We won't be able to do that today though, because: static void ReindexPartitionedIndex(Relation parentIdx) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("REINDEX is not yet implemented for partitioned indexes"))); } > No objections to the proposal. Allowing find_inheritance_children to > find index trees for partitioned indexes could be actually useful for > extensions like pg_partman. Thanks. Attached a patch to set relhassubclass when an index partition is added to a partitioned index. Regards, Amit
Вложения
В списке pgsql-hackers по дате отправления: