Class QueryProfiler

java.lang.Object
com.loomcache.server.query.QueryProfiler

public class QueryProfiler extends Object
Profiles query execution stages to identify bottlenecks. Tracks timing and row processing for each stage of query execution.
  • Constructor Details

    • QueryProfiler

      public QueryProfiler(String sql)
      Creates a new QueryProfiler for profiling a specific SQL query.
      Parameters:
      sql - the SQL query being profiled
  • Method Details

    • beginStage

      public void beginStage(QueryProfiler.Stage stage)
      Begins profiling a stage.
      Parameters:
      stage - the query stage to profile
    • endStage

      public void endStage(QueryProfiler.Stage stage, long rowsProcessed)
      Ends profiling a stage and records timing and row count.
      Parameters:
      stage - the query stage being completed
      rowsProcessed - number of rows processed in this stage
    • getProfile

      public QueryProfiler.QueryProfile getProfile()
      Returns the complete query profile with bottleneck analysis.
      Returns:
      QueryProfile with all stage information
    • getStageDurationNs

      public long getStageDurationNs(QueryProfiler.Stage stage)
      Returns timing for a specific stage in nanoseconds.
      Parameters:
      stage - the stage to query
      Returns:
      duration in nanoseconds, or 0 if not profiled
    • getStageRowCount

      public long getStageRowCount(QueryProfiler.Stage stage)
      Returns row count for a specific stage.
      Parameters:
      stage - the stage to query
      Returns:
      row count, or 0 if not profiled
    • getStageDurationMs

      public long getStageDurationMs(QueryProfiler.Stage stage)
      Returns timing for a specific stage in milliseconds.
      Parameters:
      stage - the stage to query
      Returns:
      duration in milliseconds, or 0 if not profiled