Re: stored procedure stats in collector

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: stored procedure stats in collector
Date: 2007-09-26 10:42:19
Message-ID: 200709261042.l8QAgJx00445@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


This has been saved for the 8.4 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Martin Pihlak wrote:
> Howdy,
>
> Here's an updated version of the function stats patch. The biggest change is
> that by default only procedural language functions are counted. The GUC variable
> stats_function_level now takes 3 values: on, off and all. The latter also
> counts SQL and C language functions, "on" means only to count procedural
> language functions. The decision is now made in fmgr_info_cxt_security()
> Trigger functions are now also counted.
>
> Sample output:
>
> select procname, calls, total_time, total_cpu, self_time, self_cpu
> from pg_stat_user_functions order by self_cpu desc limit 5;
>
> procname | calls | total_time | total_cpu | self_time | self_cpu
> --------------------+-------+------------+-----------+-----------+----------
> next_batch | 32765 | 27139 | 8574 | 27139 | 8574
> fetch_batch_events | 3636 | 9252 | 5622 | 3771 | 2717
> batch_event_sql | 3636 | 5454 | 2888 | 3910 | 1962
> finish_batch | 3420 | 3215 | 1475 | 3215 | 1475
> batch_event_tables | 3636 | 1448 | 865 | 1434 | 858
> (5 rows)
>
> This is still 8.2 only (tested on 8.2.4 and 8.2.5), has seen some production
> usage here at Skype (about a month on reasonably busy boxes). So far so good.
>
> Couple of issues:
> - sometimes self_cpu > self_time - currently blaming it on Linux version of
> gettimeofday().
> - dropped functions are not purged from stats, might bloat the stats file for
> some usage patterns.
>
> PS. Would something like this be a canditate for 8.4 inclusion (if polished up)?
>
> Regards,
> Martin
>

[ application/x-gzip is not supported, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kuriakose, Cinu Cheriyamoozhiyil 2007-09-26 10:48:54 Regression test message
Previous Message Michael Meskes 2007-09-26 10:08:12 Re: Other ecpg thread unsafety