Re: How does postgres store the join predicate for a relation in a given query

From: Gourav Kumar <gourav1905(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How does postgres store the join predicate for a relation in a given query
Date: 2017-10-12 16:32:45
Message-ID: CAPzqDmiQOwkei1cCH=7arkxGPmn-WTyS7y_Hr1Xr1iLyuCnMcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ashutosh,

I have the RelOptInfo data structure for the relations which are to be
joined but when I check their joininfo, it is empty.
Does baserestrictinfo contains base predicates ?

Thanks
Gourav.

On 11 October 2017 at 12:00, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com
> wrote:

> On Tue, Oct 10, 2017 at 7:29 PM, Gourav Kumar <gourav1905(at)gmail(dot)com>
> wrote:
> > Hi all,
> >
> > When you fire a query in postgresql, it will first parse the query and
> > create the data structures for storing various aspects of the query and
> > executing the query. (Like RangeTblEntry, PlannerInfo, RangeOptInfo
> etc.).
> >
> > I want to know how does postgresql stores the join predicates of a query.
> > Like which data structure is used to store the join predicates.
> >
> > How can we find the join predicates applied on a relation from relid,
> Oid or
> > RangeTblEntry ?
> >
>
> Every relation has a RelOptInfo associated with it. Predicates
> applicable to it are stored in this RelOptInfo as a list. For base
> relations (simple tables) it's in baserestrictinfo. The join
> predicates applicable are in joininfo. You can get RelOptInfo of a
> given simple table using find_base_rel().
>
> HTH.
>
>
> --
> Best Wishes,
> Ashutosh Bapat
> EnterpriseDB Corporation
> The Postgres Database Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-10-12 16:38:36 Re: How does postgres store the join predicate for a relation in a given query
Previous Message Robert Haas 2017-10-12 16:16:59 Re: advanced partition matching algorithm for partition-wise join