github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/table/stats/stats.go (about)

     1  package stats
     2  
     3  import "time"
     4  
     5  // QueryPhase holds query execution phase statistics.
     6  type QueryPhase interface {
     7  	// NextTableAccess returns next accessed table within query execution phase.
     8  	// If ok flag is false, then there are no more accessed tables and t is invalid.
     9  	NextTableAccess() (t *TableAccess, ok bool)
    10  	Duration() time.Duration
    11  	CPUTime() time.Duration
    12  	AffectedShards() uint64
    13  	IsLiteralPhase() bool
    14  }
    15  
    16  // QueryStats holds query execution statistics.
    17  type QueryStats interface {
    18  	ProcessCPUTime() time.Duration
    19  	Compilation() (c *CompilationStats)
    20  	QueryPlan() string
    21  	QueryAST() string
    22  	TotalCPUTime() time.Duration
    23  	TotalDuration() time.Duration
    24  
    25  	// NextPhase returns next execution phase within query.
    26  	// If ok flag is false, then there are no more phases and p is invalid.
    27  	NextPhase() (p QueryPhase, ok bool)
    28  }
    29  
    30  // CompilationStats holds query compilation statistics.
    31  type CompilationStats struct {
    32  	FromCache bool
    33  	Duration  time.Duration
    34  	CPUTime   time.Duration
    35  }
    36  
    37  // TableAccess contains query execution phase's table access statistics.
    38  type TableAccess struct {
    39  	Name    string
    40  	Reads   OperationStats
    41  	Updates OperationStats
    42  	Deletes OperationStats
    43  }
    44  
    45  type OperationStats struct {
    46  	Rows  uint64
    47  	Bytes uint64
    48  }