0

I'm trying to profile my requests to PostgreSQL and there are a bunch of PL/pgSQL calls involved as well which in turn they call other functions and run queries.

The results provided by pg_stat_statements show very useful data for queries executed and functions called like mean_time and total_time in milliseconds. But unfortunately, the documentation does not specify whether these numbers are showing the time of duration executing a function's body only or it also includes inner function calls as well.

Does anyone know a reference stating which one is the case?

Mehran
  • 15,593
  • 27
  • 122
  • 221

1 Answers1

1

The measured time will be the execution time for the SQL statement, which includes all functions called in the SQL statements and all functions called from these functions.

From what you describe, it seems like you could use plprofiler which enables you to profile time spent in PL/pgSQL functions, either for a single function call or for the complete application activity.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263