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

2017-10-15 Thread Ashutosh Bapat
On Sat, Oct 14, 2017 at 3:15 AM, Gourav Kumar wrote: > Why does have_relevant_joinclause() and have_relevant_eclass_joinclause() > return true for all possible joins for the query given below. > Even when they have no join predicate between them. > e.g. join between ss1 & ws3, ss2 & ws3 etc. > Th

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

2017-10-13 Thread Gourav Kumar
Why does have_relevant_joinclause() and have_relevant_eclass_joinclause() return true for all possible joins for the query given below. Even when they have no join predicate between them. e.g. join between ss1 & ws3, ss2 & ws3 etc. The query is : TPC-DS query 50 -- query 50 in stream 0 using tem

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

2017-10-12 Thread Gourav Kumar
Well for this given query it is possible. I haven't come across any such query yet. Possibly because I am more concerned about the TPCDS and TPCH benchmarks, where it's less likely to occur. On 13 October 2017 at 00:52, Tom Lane wrote: > Gourav Kumar writes: > > A Join clause/predicate will on

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

2017-10-12 Thread Tom Lane
Gourav Kumar writes: > A Join clause/predicate will only mention 2 relations. It can't have 3 or > more relations. Really? What of, say, select ... from a,b,c where (a.x + b.y) = c.z; regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@pos

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

2017-10-12 Thread Gourav Kumar
A Join clause/predicate will only mention 2 relations. It can't have 3 or more relations. On 12 October 2017 at 23:14, Tom Lane wrote: > Gourav Kumar writes: > > 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

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

2017-10-12 Thread Tom Lane
Gourav Kumar writes: > 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. Hm, well, you could adapt the logic in have_relevant_joinclause() and

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

2017-10-12 Thread Gourav Kumar
What is meant by "unstructured Join"? Thanks, Gourav On 12 October 2017 at 22:47, Gourav Kumar wrote: > 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

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

2017-10-12 Thread Gourav Kumar
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->

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

2017-10-12 Thread Tom Lane
Gourav Kumar 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 c

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

2017-10-12 Thread Gourav Kumar
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 wrote: > On Tue, Oct 10, 2017 at 7:29 PM, Gourav

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

2017-10-10 Thread Ashutosh Bapat
On Tue, Oct 10, 2017 at 7:29 PM, Gourav Kumar 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 wan

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

2017-10-10 Thread Nico Williams
On Tue, Oct 10, 2017 at 07:29:24PM +0530, Gourav Kumar wrote: > 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 t

[HACKERS] How does postgres store the join predicate for a relation in a given query

2017-10-10 Thread Gourav Kumar
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 quer