| From: | Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Cc: | Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com> |
| Subject: | Re: stored procedure stats in collector |
| Date: | 2007-09-20 13:08:58 |
| Message-ID: | 46F270EA.8040103@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| 8.2-procstat.patch.gz | application/x-gzip | 12.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2007-09-20 13:42:20 | Re: like/ilike improvements |
| Previous Message | Hannes Eder | 2007-09-20 12:06:08 | minor compiler warning in backend/utils/adt/tsrank.c |