Unix Technical Forum

Logging query plan for queries

This is a discussion on Logging query plan for queries within the Pgsql General forums, part of the PostgreSQL category; --> when i enable debug_print_plan and debug_pretty_print... query plans are written to log file for all queries....(3 gb of logs ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 09:18 PM
Himanshu Baweja
 
Posts: n/a
Default Logging query plan for queries

when i enable debug_print_plan and
debug_pretty_print...
query plans are written to log file for all
queries....(3 gb of logs in 3 mins) which is of course
diffcult to analyze and consume too much resources....

is it possible to log plans for only the queries whose
duration was more than a particular value or something
like that... (e.g. log_min_duration_statement)....

thx
Himanshu

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:18 PM
Bruce Momjian
 
Posts: n/a
Default Re: Logging query plan for queries

Himanshu Baweja wrote:
> when i enable debug_print_plan and
> debug_pretty_print...
> query plans are written to log file for all
> queries....(3 gb of logs in 3 mins) which is of course
> diffcult to analyze and consume too much resources....
>
> is it possible to log plans for only the queries whose
> duration was more than a particular value or something
> like that... (e.g. log_min_duration_statement)....


Sure, see log_min_duration_statement.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:18 PM
Himanshu Baweja
 
Posts: n/a
Default Re: Logging query plan for queries


--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> > is it possible to log plans for only the queries

> whose
> > duration was more than a particular value or

> something
> > like that... (e.g. log_min_duration_statement)....

>
> Sure, see log_min_duration_statement.


i think bruce u got my question wrong...
log_min_duration_statement will log only the queries
which are longer than a particular value... and if i
turn debug_print_plan.... it will log plans for all
the queries irrespective of the value of
log_min_duration_statement...
that is wht my testing says....

plz point out if i am wrong...
and also... is there any way of logging plans for only
a part of queries which satisfy a particular duration
criteria...

thx
Himanshu

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 09:18 PM
Bruce Momjian
 
Posts: n/a
Default Re: Logging query plan for queries

Himanshu Baweja wrote:
>
> --- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> > > is it possible to log plans for only the queries

> > whose
> > > duration was more than a particular value or

> > something
> > > like that... (e.g. log_min_duration_statement)....

> >
> > Sure, see log_min_duration_statement.

>
> i think bruce u got my question wrong...
> log_min_duration_statement will log only the queries
> which are longer than a particular value... and if i
> turn debug_print_plan.... it will log plans for all
> the queries irrespective of the value of
> log_min_duration_statement...
> that is wht my testing says....
>
> plz point out if i am wrong...
> and also... is there any way of logging plans for only
> a part of queries which satisfy a particular duration
> criteria...


Oh, log _plans_ for queries over a certain duration --- we don't have
any way to support that, sorry. In fact, at plan time we don't even
know how long it will take for the query to run.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com