plprofiler is an extension or a tool that can be extensively used to profile functions in PostgreSQL. When enabled as an extension, profile data can be collected for all the PL/pgSQL code being executed in a database (on-demand but not automatically). This profile data is stored within internal hash tables and it can be presented in an HTML report using an external tool.
There are two modes in which plprofiler can operate :
- Session level: During the migration of an Oracle database or a different database to PostgreSQL or while developing a new application functionality through a function, a developer may wish to see the time consumed for every line of code. This helps the developer to tune time-consuming queries or tune conditional logic that may be causing a delay in the function execution. For this reason, we can enable plprofiler at the session level and execute the function. This may also be referred to as local-data. ...