This topic describes how to use the plprofiler plug-in to analyze the performance of a PolarDB for PostgreSQL cluster.
Background information
When you use a PostgreSQL server for programming, you can find that a function or a stored procedure written in Procedural Language/PostgreSQL (PL/pgSQL) is a black box. This means that PostgreSQL rarely knows what operations are performed inside a function or a stored procedure. Therefore, each SQL statement error in PL/pgSQL may cause performance bottlenecks. The following common PL/pgSQL issues may occur:
- A faulty statement is executed at a fast speed first. However, after the statement is called many times, the statement is executed at a low speed.
- Performance bottlenecks randomly occur.
- Performance issues occur in the production environment.
To troubleshoot these performance issues, you can only manually analyze the schemas, statistics, and SQL statements or use the pldebugger plug-in. These troubleshooting methods are time-consuming and the results are not displayed clearly. Performance issues randomly occur, which complicates the troubleshooting process. You cannot even identify the cause of the first issue by using these methods. A better troubleshooting method is required to help you identify the performance bottlenecks.
The plprofiler plug-in provides an easy method for you to collect PL/pgSQL performance data and identify the performance issues of PL/pgSQL. This helps you optimize the performance of specific functions, stored procedures, and schemas. For more information about the plug-in, see plprofiler.