Enabling and Disabling Profiling

You can enable and disable profiling for a specific category globally (for the entire database) and the current session. Use SHOW_PROFILING_CONFIG to determine whether profiling is enabled. Output from this command shows:

In the following example, SHOW_PROFILING_CONFIG shows that profiling is enabled globally (Global on) across all profiling categories—session, EE (execution engine), and query. For the current session, it is disabled (Session off) across all categories:

=> SELECT SHOW_PROFILING_CONFIG();
SHOW_PROFILING_CONFIG
------------------------------------------
 Session Profiling: Session off, Global on
 EE Profiling:      Session off, Global on
 Query Profiling:   Session off, Global on
(1 row)

Enable or Disable Global Profiling

ALTER DATABASE db-name SET profiling-category = {0 | 1}

where profiling-category is set to one of the following arguments:

Use this argument... To specify...
GlobalSessionProfiling Session profile data
GlobalQueryProfiling Query data
GlobalEEProfiling Execution engine data

For example, the following statement globally enables query profiling:

=> ALTER DATABASE mydb SET GlobalQueryProfiling = 1;

Enable or Disable Session Profiling

ENABLE_PROFILING( profiling-category )
DISABLE_PROFILING( profiling-category )

where profiling-category is set to one of the following arguments:

Use this argument... To specify...
session Session profile data
query Query data
ee Execution engine data

For example, the following statement enables session-scoped profiling for the execution run of each query:

=> SELECT ENABLE_PROFILING('ee');
   ENABLE_PROFILING
----------------------
 EE Profiling Enabled
(1 row)