Skip to content

A PostgreSQL extension for automatically creating function call graphs

Notifications You must be signed in to change notification settings

postsql/call_graph

 
 

Repository files navigation

Call_Graph is a module for PostgreSQL 9.1 and later which automatically tracks
function calls inside the database.  That information can then be used to
create call graphs.

The module needs to be loaded when the PostgreSQL server starts so you should
add 'call_graph' to your  shared_preload_libraries  in your postgresql.conf.
You should also add 'call_graph' to your custom_variable_classes.  The
extension installs itself into the "call_graph" schema, creating it in case it
doesn't exist.

By default, the module does not track any function calls.  To enable tracking,
you need to enable the call_graph.enable GUC.  You can do that on a per-session
(or even per-transaction) basis, or you can set it in postgresql.conf.  See the
official PostgreSQL documentation for more information.

It is also possible to track table usage information for each call graph.
However, due to the way this is currently implemented, it comes with a
significant performance penalty.  You can enable table usage tracking
by setting  call_graph.track_table_usage.

To avoid lock contention the backends only append data into an unlogged table.
That table can then be periodically processed (using the
ProcessCallGraphBuffers function) to create the call graph information.  In this
session, you will probably also want to set the configuration parameter
"call_graph.enable" to false to avoid generating data for the
ProcessCallGraphBuffers function.

Note that installing the extension grants public access to the CallGraphBuffer
table, which means that malicious users can add bogus data into the table.

About

A PostgreSQL extension for automatically creating function call graphs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 66.1%
  • C 33.9%