[HACKERS] Eliminating unnecessary left joins

2007-04-06 Thread Ottó Havasvölgyi
Hi, When using views built with left joins, and then querying against these views, there are a lot of join in the plan that are not necessary, because I don't select/use any column of each table in the views every time. Tables that are left joined and never referenced anywhere else in the query

Re: [HACKERS] Eliminating unnecessary left joins

2007-04-07 Thread Ottó Havasvölgyi
Sorry, I have left out the PK requirement. What Nicolas wrote is right, I also use an O/R mapper and inheritance is solved with vertical partitioning. The tables are connected to each other with the PK. And the mapper defines views for each class with left joins. The mapper generates queries

Re: [HACKERS] Eliminating unnecessary left joins

2007-04-08 Thread Ottó Havasvölgyi
, Ottó Havasvölgyi [EMAIL PROTECTED]: My simple example: Class hierarchy and fields: Shape (ID, X, Y) | +-Circle (ID, Radius) | +-Rectangle (ID, Width, Height) The mapper creates 3 tables with the columns next to the class name. And it creates 3 views. One of them: RectangleView: SELECT

Re: [HACKERS] Eliminating unnecessary left joins

2007-04-12 Thread Ottó Havasvölgyi
sometimes will query for the status description, sometimes not. I suspect that checking to see if tables have the right unique keys or RI would add a noticeable amount of extra work to query planning, so we might want a GUC to disable it. On Apr 7, 2007, at 12:45 PM, Ottó Havasvölgyi wrote: Sorry

Re: [HACKERS] Eliminating unnecessary left joins

2007-04-16 Thread Ottó Havasvölgyi
Hi, Could you Bruce please add a TODO item for this feature? The description could look something like this: Eliminate the table T from the query/subquery if the following requirements are satisfied: 1. T is left joined 2. T is referenced only in the join expression where it is left joined 3.

Re: [HACKERS] Eliminating unnecessary left joins

2007-04-21 Thread Ottó Havasvölgyi
But then what about the null values? Perhaps unique + notnull is better? Otto 2007/4/20, Nicolas Barbier [EMAIL PROTECTED]: 2007/4/16, Ottó Havasvölgyi [EMAIL PROTECTED]: Eliminate the table T from the query/subquery if the following requirements are satisfied: 1. T is left joined 2. T