On Tue, Jul 15, 2014 at 2:17 PM, Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> wrote: > > Hi, the attached is the revised version.
Thanks Horiguchi-San for the updated patch. Today while looking into updated patch, I was wondering why can't we eliminate useless keys in query_pathkeys when we actually build the same in function standard_qp_callback(), basically somewhat similar to what we do in standard_qp_callback->make_pathkeys_for_sortclauses->pathkey_is_redundant(). We already have index information related to base_rels before building query pathkeys. I noticed that you mentioned the below in your original mail which indicates that information related to inheritance tables is built only after set_base_rel_sizes() "These steps take place between set_base_rel_sizes() and set_base_rel_pathlists() in make_one_rel(). The reason for the position is that the step 2 above needs all inheritence tables to be extended in PlannerInfo and set_base_rel_sizes (currently) does that". Now I am not sure why such information is not build during build_simple_rel() in below code path: build_simple_rel() { .. if (rte->inh) { ListCell *l; foreach(l, root->append_rel_list) { AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(l); /* append_rel_list contains all append rels; ignore others */ if (appinfo->parent_relid != relid) continue; (void) build_simple_rel(root, appinfo->child_relid, RELOPT_OTHER_MEMBER_REL); } } } Could you please explain me why the index information built in above path is not sufficient or is there any other case which I am missing? With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com