Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OptimizationSuggestion ¶
OptimizationSuggestion represents a suggestion for a query optimization.
func AnalyzeQueries ¶
func AnalyzeQueries(entries []PgStatStatementEntry) []OptimizationSuggestion
AnalyzeQueries analyzes an array of PgStatStatementEntry and returns optimization suggestions.
type PgStatStatementEntry ¶
type PgStatStatementEntry struct { UserID int64 `db:"userid"` DbID int64 `db:"dbid"` TopLevel bool `db:"toplevel"` QueryID int64 `db:"queryid"` Query string `db:"query"` Plans int64 `db:"plans"` TotalPlanTime float64 `db:"total_plan_time"` MinPlanTime float64 `db:"min_plan_time"` MaxPlanTime float64 `db:"max_plan_time"` MeanPlanTime float64 `db:"mean_plan_time"` StddevPlanTime float64 `db:"stddev_plan_time"` Calls int64 `db:"calls"` TotalExecTime float64 `db:"total_exec_time"` MinExecTime float64 `db:"min_exec_time"` MaxExecTime float64 `db:"max_exec_time"` MeanExecTime float64 `db:"mean_exec_time"` StddevExecTime float64 `db:"stddev_exec_time"` Rows int64 `db:"rows"` LocalBlksHit int64 `db:"local_blks_hit"` LocalBlksRead int64 `db:"local_blks_read"` LocalBlksDirtied int64 `db:"local_blks_dirtied"` LocalBlksWritten int64 `db:"local_blks_written"` TempBlksRead int64 `db:"temp_blks_read"` TempBlksWritten int64 `db:"temp_blks_written"` BlkReadTime float64 `db:"blk_read_time"` BlkWriteTime float64 `db:"blk_write_time"` TempBlkReadTime float64 `db:"temp_blk_read_time"` TempBlkWriteTime float64 `db:"temp_blk_write_time"` WalRecords int64 `db:"wal_records"` WalFPI int64 `db:"wal_fpi"` WalBytes int64 `db:"wal_bytes"` JitFunctions int64 `db:"jit_functions"` JitGenerationTime float64 `db:"jit_generation_time"` JitInliningCount int64 `db:"jit_inlining_count"` JitInliningTime float64 `db:"jit_inlining_time"` JitOptimizationCount int64 `db:"jit_optimization_count"` JitOptimizationTime float64 `db:"jit_optimization_time"` JitEmissionCount int64 `db:"jit_emission_count"` JitEmissionTime float64 `db:"jit_emission_time"` }
PgStatStatementEntry represents a single entry from pg_stat_statements.
func ConnectAndFetchPgStatStatements ¶
func ConnectAndFetchPgStatStatements(dsn string) ([]PgStatStatementEntry, error)
func GetPgStatStatements ¶
func GetPgStatStatements(db *sqlx.DB) ([]PgStatStatementEntry, error)
GetPgStatStatements fetches the pg_stat_statements from the database.
Click to show internal directories.
Click to hide internal directories.