Re: [PERFORM] Adding an additional join causes very different/slow query plan

2013-12-16 Thread Joe Van Dyk
On Mon, Dec 16, 2013 at 4:14 PM, Tom Lane wrote: > Joe Van Dyk writes: > > Hm, setting set join_collapse_limit = 9 seemed to fix the problem. Is > that > > my best/only option? > > Yup, that's what I was just about to suggest. You might want to use > 10 or 12 in case some of your queries are a

Re: [PERFORM] Adding an additional join causes very different/slow query plan

2013-12-16 Thread Tom Lane
Joe Van Dyk writes: > Hm, setting set join_collapse_limit = 9 seemed to fix the problem. Is that > my best/only option? Yup, that's what I was just about to suggest. You might want to use 10 or 12 in case some of your queries are a bit more complex than this one --- but don't go overboard, or yo

Re: [PERFORM] Adding an additional join causes very different/slow query plan

2013-12-16 Thread Joe Van Dyk
Hm, setting set join_collapse_limit = 9 seemed to fix the problem. Is that my best/only option? On Mon, Dec 16, 2013 at 1:52 PM, Joe Van Dyk wrote: > The actual query selects columns from each of those tables. > > If I remove the join on order_shipping_addresses, it's very fast. > Likewise, if

[PERFORM] Adding an additional join causes very different/slow query plan

2013-12-16 Thread Joe Van Dyk
The actual query selects columns from each of those tables. If I remove the join on order_shipping_addresses, it's very fast. Likewise, if I remove the join on skus, base_skus, or products, it's also very fast. I'm pretty sure I have all the necessary indexes. The below is also at https://gist.g

Re: [PERFORM] Current query of the PL/pgsql procedure.

2013-12-16 Thread Andrew Dunstan
On 12/16/2013 05:26 AM, hubert depesz lubaczewski wrote: On Sun, Dec 15, 2013 at 04:18:18PM +, Yuri Levinsky wrote: Dear ALL, I am running PL/pgsql procedure with sql statements that taking a long time. I able to see them in the log just after their completion. How can I see currently runni

Re: [PERFORM] Current query of the PL/pgsql procedure.

2013-12-16 Thread Matheus de Oliveira
On Sun, Dec 15, 2013 at 2:18 PM, Yuri Levinsky wrote: > Dear ALL, > > I am running PL/pgsql procedure with sql statements that taking a long > time. I able to see them in the log just after their completion. How can I > see currently running SQL statement? I am able to see in pg_stat_activity >

Re: [PERFORM] Current query of the PL/pgsql procedure.

2013-12-16 Thread Yuri Levinsky
Dear Depesz, This is very problematic solution: I have to change whole!!! my code to put appropriate comment with query text before any query execution. In addition I would like to know current execution plan, that seems to be impossible. This is very hard limitation let's say. In case of produ

Re: [PERFORM] Current query of the PL/pgsql procedure.

2013-12-16 Thread hubert depesz lubaczewski
On Sun, Dec 15, 2013 at 04:18:18PM +, Yuri Levinsky wrote: > Dear ALL, > I am running PL/pgsql procedure with sql statements that taking a long > time. I able to see them in the log just after their completion. How > can I see currently running SQL statement? I am able to see in > pg_stat_acti