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: 2008-03-26 01:42:38
Message-ID: 200803260142.m2Q1gcq29597@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


This has been saved for the next commit-fest:

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://postgres.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 Tom Lane 2008-03-26 01:46:20 Re: advancing snapshot's xmin
Previous Message Sam Mason 2008-03-26 01:35:57 Re: writing a MIN(RECORD) aggregate