<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Track_functions on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/track_functions/</link><description>Recent content in Track_functions on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Sun, 22 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/track_functions/index.xml" rel="self" type="application/rss+xml"/><item><title>Track Function Execution Stats with pg_stat_user_functions</title><link>https://www.postgresscripts.com/post/track-function-execution-stats-with-pg-stat-user-functions/</link><pubDate>Sun, 22 Nov 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/track-function-execution-stats-with-pg-stat-user-functions/</guid><description>
&lt;h2 id="track-function-execution-stats-with-pg_stat_user_functions"&gt;Track Function Execution Stats with pg_stat_user_functions&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;pg_stat_user_functions&lt;/code&gt; holds one row for each tracked function. Each row shows how many times the function ran, the total time spent in it, and the time spent in its own body. On a default install the view is empty, because &lt;code&gt;track_functions&lt;/code&gt; starts at &lt;code&gt;none&lt;/code&gt;. The script below joins the view to &lt;code&gt;pg_proc&lt;/code&gt; and returns the 300 functions with the highest &lt;code&gt;total_time&lt;/code&gt;, each with a quoted full name and its oid.&lt;/p&gt;</description></item></channel></rss>