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

From: Gourav Kumar <gourav1905(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, 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 17:17:14
Message-ID: CAPzqDmjAyRG_sGRZFHjKCnVXomZEwjcdn65g7TTWtwF30JCL+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

My objective is to construct join graph from a given query.
A join graph, has a node for each relation involved in a join, and an edge
between two relations if they share a join predicate among them.

To do this I first tried to use the make_join_rel() function
- There I checked if they root->join->cur->level is 2, just write the
relation names to a file.
- But this strategy failed, because if there is somewhere a Cartesian
product among two relations, then they can't have an edge in the join graph.
- So, along with writing the relation name, I need to know if they
share a join predicate among them or not.

On 12 October 2017 at 22:08, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Gourav Kumar <gourav1905(at)gmail(dot)com> writes:
> > I have the RelOptInfo data structure for the relations which are to be
> > joined but when I check their joininfo, it is empty.
>
> You aren't telling us anything much about the case you're studying,
> but if the join clauses have the form of equality comparisons, they
> likely got converted into EquivalenceClass data structures instead.
> These days the joininfo lists only contain "unstructured" join
> conditions.
>
> regards, tom lane
>

--
Thanks,
Gourav Kumar
Computer Science and Automation
Indian Institute of Science

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gourav Kumar 2017-10-12 17:18:05 Re: How does postgres store the join predicate for a relation in a given query
Previous Message Tom Lane 2017-10-12 17:03:59 Re: [HACKERS] pgsql: Add port/strnlen support to libpq and ecpg Makefiles.