Class QueryProfiler
java.lang.Object
com.loomcache.server.query.QueryProfiler
Profiles query execution stages to identify bottlenecks.
Tracks timing and row processing for each stage of query execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord representing a single profiling entry for a stage.static final recordComplete query profile with stage information and bottleneck identification.static enumQuery execution stages. -
Constructor Summary
ConstructorsConstructorDescriptionQueryProfiler(String sql) Creates a new QueryProfiler for profiling a specific SQL query. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginStage(QueryProfiler.Stage stage) Begins profiling a stage.voidendStage(QueryProfiler.Stage stage, long rowsProcessed) Ends profiling a stage and records timing and row count.Returns the complete query profile with bottleneck analysis.longReturns timing for a specific stage in milliseconds.longReturns timing for a specific stage in nanoseconds.longReturns row count for a specific stage.
-
Constructor Details
-
QueryProfiler
Creates a new QueryProfiler for profiling a specific SQL query.- Parameters:
sql- the SQL query being profiled
-
-
Method Details
-
beginStage
Begins profiling a stage.- Parameters:
stage- the query stage to profile
-
endStage
Ends profiling a stage and records timing and row count.- Parameters:
stage- the query stage being completedrowsProcessed- number of rows processed in this stage
-
getProfile
Returns the complete query profile with bottleneck analysis.- Returns:
- QueryProfile with all stage information
-
getStageDurationNs
Returns timing for a specific stage in nanoseconds.- Parameters:
stage- the stage to query- Returns:
- duration in nanoseconds, or 0 if not profiled
-
getStageRowCount
Returns row count for a specific stage.- Parameters:
stage- the stage to query- Returns:
- row count, or 0 if not profiled
-
getStageDurationMs
Returns timing for a specific stage in milliseconds.- Parameters:
stage- the stage to query- Returns:
- duration in milliseconds, or 0 if not profiled
-