Re: Use unique index for longer pathkeys. - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Use unique index for longer pathkeys.
Date
Msg-id CAA4eK1+21iLsU0RC_1Ep75aeFSWrWH+7OGzHcjsjw5JXpsEbuQ@mail.gmail.com
Whole thread Raw
In response to Re: Use unique index for longer pathkeys.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: Use unique index for longer pathkeys.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List pgsql-hackers
On Tue, Jul 15, 2014 at 2:17 PM, Kyotaro HORIGUCHI <horiguchi.kyotaro@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

pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: [bug fix] Suppress "autovacuum: found orphan temp table" message
Next
From: John Cochran
Date:
Subject: Re: Proposal for updating src/timezone