Re: [HACKERS] Turn off transitive joins

2017-10-14 Thread Gourav Kumar
I don't think there is any need to add any such capability in postgresql, but I need it for my work. I need the join qualifiers. On 15-Oct-2017 1:37 AM, "Tom Lane" wrote: > Gourav Kumar writes: > > Is there some way by which I can tell postgresql to not to consider &g

[HACKERS] Turn off transitive joins

2017-10-14 Thread Gourav Kumar
Hi all, Is there some way by which I can tell postgresql to not to consider transitive joins while considering join pairs. I.e. Let's say a query has two join predicates one between A & B relations and the other between B and C relations. While constructing the DP to find the best join order, th

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
I want to get the join graph of a given query. Which has node for each relation and an edge between two nodes if they have a join predicate among them. On 14-Oct-2017 3:58 AM, "Andres Freund" wrote: > On 2017-10-14 03:49:57 +0530, Gourav Kumar wrote: > > But then is the

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
But then is there some way to tell Optimizer not to consider transitive joins ? Or to know if the join is transitive or not ? On 14-Oct-2017 3:43 AM, "Tom Lane" wrote: > Gourav Kumar writes: > > For e.g. I am checking for this query > > ... > > where > >

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

2017-10-13 Thread Gourav Kumar
.store_sales else null end and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end order by web_q2_q3_increase; -- end On 13 October 2017 at 01:00, Gourav Kumar wrote: &

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
't has a join predicate between ss1 and ws2 or ss1 and ws3. But optimizer still considers a join among them. On 14 October 2017 at 02:20, Gourav Kumar wrote: > I tried debugging the code, at no point in execution the function > make_rels_by_clauseless_joins was called. Although op

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
I tried debugging the code, at no point in execution the function make_rels_by_clauseless_joins was called. Although optimizer did consider some of the joins which are cross products. On 14 October 2017 at 01:57, Gourav Kumar wrote: > Can I use something like joininfo, which will store

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
t 5:08 PM, Robert Haas > wrote: > > > > On Fri, Oct 13, 2017 at 4:06 PM, Gourav Kumar > wrote: > > > Can you guide me where to look for it? > > > > Search for make_rels_by_clauseless_joins. > > > > I wonder if it's possible implement it as an

Re: [HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
Can you guide me where to look for it? On 14 October 2017 at 01:35, Robert Haas wrote: > On Fri, Oct 13, 2017 at 3:41 PM, Gourav Kumar > wrote: > > is there some way through which I can disable cross products in > postgresql? > > > > This will make the DP join to n

[HACKERS] Disable cross products in postgres

2017-10-13 Thread Gourav Kumar
Hi all, is there some way through which I can disable cross products in postgresql? This will make the DP join to not to consider join between two relations if they don't have a join predicate among them. Thanks, Gourav Kumar Computer Science and Automation Indian Institute of Science

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 cl

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 inv

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 i

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

2017-10-12 Thread Gourav Kumar
f they share a join predicate among them or not. On 12 October 2017 at 22:08, Tom Lane wrote: > 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 tellin

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, Gou

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

2017-10-10 Thread Gourav Kumar
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 ? I want to construct a join graph for a given query, for which I need the join predicates between two relations. -- Thanks, Gourav Kumar