Live query plan extension settings

Set these parameters on the WarehousePG cluster, not in WEM, to tune the whpg_live_query_plan extension behind the live plan. The defaults work for most clusters. See Viewing query plans.

Setting the extension's parameters

All of the extension's parameters use the whpg_live_query_plan. prefix. Set them with gpconfig as gpadmin on the coordinator. A parameter marked Restart in the extension and WarehousePG parameter tables takes effect after you run gpstop -raf. A parameter marked Reload takes effect after you run gpstop -u.

For example:

gpconfig -c whpg_live_query_plan.max_slots -v 400
gpstop -raf

To check the current value, run SHOW whpg_live_query_plan.max_slots;.

Extension parameters

ParameterDefaultRangeAppliesDescription
whpg_live_query_plan.max_slots00–262143RestartNumber of statements the extension can track at once. 0 uses the value of max_connections. A statement that starts when all slots are in use has no live plan. Each slot uses whpg_live_query_plan.slot_bytes of shared memory on the coordinator.
whpg_live_query_plan.slot_bytes131072 (128 KiB)4096–268435456RestartShared memory for the plan of each tracked statement, in bytes. The default holds about 454 steps. Raise it for statements with deep partition trees. A plan that doesn't fit is cut off, and plan_truncated is true in the output of whpg_live_query_plan.
whpg_live_query_plan.timingonon, offReloadRecord the time each step takes, as EXPLAIN ANALYZE does. This adds a small CPU cost to every tracked statement. With off, step times stay at zero and the other counters aren't affected.
whpg_live_query_plan.summary_max_segments50–64Reload or sessionNumber of segments in each of the Top segments by rows and Slowest segments by time lists of a step. 0 leaves both lists empty. To change it for one SQL session, use SET whpg_live_query_plan.summary_max_segments = 10;.
whpg_live_query_plan.finished_rows163840–4194304RestartNumber of entries that keep the final counters of segments that have finished a step, so they stay in the totals and the skew while other segments still work. 0 turns this off.
Note

Each entry uses 48 bytes on every segment and mirror, but not on the coordinator or standby. The default uses 768 KiB and the maximum uses 192 MiB. The oldest entries are overwritten first. A larger finished_rows makes every refresh of the live plan slower, because each segment scans all the entries. Raise it only when the totals of a long query lose finished segments while many short statements run.

WarehousePG parameters the live plan depends on

The live plan also depends on these WarehousePG parameters. For the full descriptions of shared_preload_libraries and track_activity_query_size, see the configuration parameters in the WarehousePG 6 and 7 documentation.

ParameterRequired valueAppliesDescription
shared_preload_librariesIncludes whpg_live_query_planRestartLoads the extension on the coordinator, standby, every segment, and every mirror. Keep the libraries that are already listed. See Installing the live query plan extension.
gp_enable_query_metricsonRestartCollects the per-step counters on every segment. Without it, no plan is recorded.
gp_instrument_shmem_size5 MB or more (default)RestartSize of the shared memory for the per-step counters. Raise it, for example to 20MB, if every step in the live plan shows no data or gp_instrument_shmem_summary() shows that the slots are exhausted.
track_activity_query_sizeLarge enough for your longest statement (1024 characters by default)RestartNumber of characters WarehousePG keeps of a running statement. WEM doesn't run EXPLAIN on a statement that's cut, so its step details and Text Plan tab are off. For example, set it to 8kB.

Could this page be better? Report a problem or suggest an addition!