SYS.SET_QUERYSTATS

Enables or disables query statistics collection in the SYS.QUERYSTATS system table.

This procedure enables or disables query statistics collection for the distributed system as a whole. When you enable query statistics, GemFire XD stores statistics values for all queries in the QUERYSTATS system table. Enable statistics collection only for the purposes of profiling a fixed number of queries, and be sure to disable statistics collection after you have gathered the necessy data. See Query Execution Times for more information.

Syntax

SYS.SET_QUERYSTATS (
IN ENABLE BOOLEAN NOT NULL
)
ENABLE
Specifies whether the system should collect detailed statistics for queries in the SYS.QUERYSTATS table.

Example

This command enables query statistics collection:
gfxd> call sys.set_querystats(1);

After running the queries you want to measure, query SYS.QUERYSTATS to determine the most time-consuming queries. For example, this query shows the top 10 longest-running queries across all GemFire XD members:

gfxd> select sum(totaltime)/avg(numinvocations) t, query from sys.querystats 
> where numinvocations > 0 group by query order by t desc fetch first 10 rows only; 
This command disables query statistics collection:
gfxd> call sys.set_querystats(0);