Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-13 Thread Dimitri Fontaine
Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit more about these bad queries - and we hope, so

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-13 Thread Pavel Stehule
2013/1/13 Dimitri Fontaine dimi...@2ndquadrant.fr: Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-13 Thread Tom Lane
Dimitri Fontaine dimi...@2ndquadrant.fr writes: Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-13 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes: Set auto_explain.log_min_duration to 19 mins or maybe 17 and be done? That would only help if he were willing to wait for the long-running command to be done (instead of canceling it). It's not hard to think of commands that will still be running after the

[HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
Hello We use successfully use auto_explain. We miss support cancelled queries - we need same info for queries, that we cancel after x minutes. Subtask of this feature can be dumping currently executed query with plan and with complete query string to log after receiving some signal - maybe

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: What do you thinking about this feature? The idea of expecting an add-on module to execute operations in an already-failed transaction seems pretty dubious to me. I also think it's not a great idea to add partial executions into a query's stats. For

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: What do you thinking about this feature? The idea of expecting an add-on module to execute operations in an already-failed transaction seems pretty dubious to me. I also think it's not a great idea to add

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit more about these bad queries - and we hope, so

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit more about these bad queries - and we hope, so

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Stephen Frost sfr...@snowman.net: * Pavel Stehule (pavel.steh...@gmail.com) wrote: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Alvaro Herrera
Tom Lane escribió: Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit more about these bad

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we killing queries. But we have to know little bit more

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Simon Riggs
On 11 January 2013 15:54, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Tom Lane escribió: Pavel Stehule pavel.steh...@gmail.com writes: My propose is proposed for different dimensions and purpose - for example - we have a limit 20 minutes for almost all queries, and after this limit we

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Tom Lane
Alvaro Herrera alvhe...@2ndquadrant.com writes: Tom Lane escribió: However, auto_explain is even worse on the other problem. You flat out cannot do catalog lookups in a failed transaction, but there's no way to print a decompiled plan without such lookups. So it won't work. (It would also

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: 2013/1/11 Stephen Frost sfr...@snowman.net: Why not an option to auto_explain (or whatever) to log an execution plan right before actually executing it? If that was something which could be set with a GUC or similar, you could just do that

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Tom Lane
Simon Riggs si...@2ndquadrant.com writes: An even better feature would be to be able to send a signal to a running query to log its currently executing plan. That way you can ask Why so slow? before deciding to kill it. That could conceivably work. At least it wouldn't require running EXPLAIN

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Stephen Frost sfr...@snowman.net: * Pavel Stehule (pavel.steh...@gmail.com) wrote: 2013/1/11 Stephen Frost sfr...@snowman.net: Why not an option to auto_explain (or whatever) to log an execution plan right before actually executing it? If that was something which could be set

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Stephen Frost sfr...@snowman.net: * Pavel Stehule (pavel.steh...@gmail.com) wrote: 2013/1/11 Stephen Frost sfr...@snowman.net: Why not an option to auto_explain (or whatever) to log an execution plan right before actually executing it? If that was something which could be set

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: Simon Riggs si...@2ndquadrant.com writes: An even better feature would be to be able to send a signal to a running query to log its currently executing plan. That way you can ask Why so slow? before deciding to kill it. That could conceivably work.

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Stephen Frost sfr...@snowman.net: * Tom Lane (t...@sss.pgh.pa.us) wrote: Simon Riggs si...@2ndquadrant.com writes: An even better feature would be to be able to send a signal to a running query to log its currently executing plan. That way you can ask Why so slow? before deciding

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Pavel Stehule
2013/1/11 Pavel Stehule pavel.steh...@gmail.com: 2013/1/11 Stephen Frost sfr...@snowman.net: * Tom Lane (t...@sss.pgh.pa.us) wrote: Simon Riggs si...@2ndquadrant.com writes: An even better feature would be to be able to send a signal to a running query to log its currently executing plan.

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: 2013/1/11 Stephen Frost sfr...@snowman.net: We can send a 'cancel query', how about a 'report on query' which returns the plan and perhaps whatever other stats are easily available? there is only one question - that POSIX signal we can use?

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Simon Riggs
On 11 January 2013 16:31, Pavel Stehule pavel.steh...@gmail.com wrote: 2013/1/11 Stephen Frost sfr...@snowman.net: * Tom Lane (t...@sss.pgh.pa.us) wrote: Simon Riggs si...@2ndquadrant.com writes: An even better feature would be to be able to send a signal to a running query to log its

Re: [HACKERS] ToDo: log plans of cancelled queries

2013-01-11 Thread Simon Riggs
On 11 January 2013 16:52, Simon Riggs si...@2ndquadrant.com wrote: We already overload the signals, so its just a new type for the signal handler to cope with. See procsignal_sigusr1_handler() I roughed up something to help you here... this is like 50% of a patch. pg_explain_backend() calls