db2

package
v0.20.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db2QueryLogSchema

type Db2QueryLogSchema struct {
	ExecutableId       string     `db:"EXECUTABLE_ID"`
	StmtId             *int64     `db:"STMTID"`
	PlanId             *int64     `db:"PLANID"`
	Member             *int64     `db:"MEMBER"`
	SectionType        *string    `db:"SECTION_TYPE"`
	PackageSchema      *string    `db:"PACKAGE_SCHEMA"`
	PackageName        *string    `db:"PACKAGE_NAME"`
	StmtTypeId         *string    `db:"STMT_TYPE_ID"`
	InsertTimestamp    *time.Time `db:"INSERT_TIMESTAMP"`
	LastMetricsUpdate  *time.Time `db:"LAST_METRICS_UPDATE"`
	NumExecutions      *int64     `db:"NUM_EXECUTIONS"`
	NumExecWithMetrics *int64     `db:"NUM_EXEC_WITH_METRICS"`
	TotalActTime       *int64     `db:"TOTAL_ACT_TIME"`
	TotalActWaitTime   *int64     `db:"TOTAL_ACT_WAIT_TIME"`
	TotalCpuTime       *int64     `db:"TOTAL_CPU_TIME"`
	RowsRead           *int64     `db:"ROWS_READ"`
	RowsReturned       *int64     `db:"ROWS_RETURNED"`
	RowsModified       *int64     `db:"ROWS_MODIFIED"`
	TotalSorts         *int64     `db:"TOTAL_SORTS"`
	LogicalReads       *int64     `db:"LOGICAL_READS"`
	PhysicalReads      *int64     `db:"PHYSICAL_READS"`
	QueryCostEstimate  *int64     `db:"QUERY_COST_ESTIMATE"`
	DatabaseName       string     `db:"DATABASE_NAME"`
	StmtText           *string    `db:"STMT_TEXT"`
}

Db2QueryLogSchema maps a row of MON_GET_PKG_CACHE_STMT (query_logs.sql).

type Db2Scrapper

type Db2Scrapper struct {
	// contains filtered or unexported fields
}

func NewDb2Scrapper

func NewDb2Scrapper(ctx context.Context, conf *Db2ScrapperConf) (*Db2Scrapper, error)

func (*Db2Scrapper) Capabilities

func (e *Db2Scrapper) Capabilities() scrapper.Capabilities

func (*Db2Scrapper) Close

func (e *Db2Scrapper) Close() error

func (*Db2Scrapper) DialectType

func (e *Db2Scrapper) DialectType() string

func (*Db2Scrapper) EstimateQuery

func (e *Db2Scrapper) EstimateQuery(ctx context.Context, sql string) (*scrapper.QueryEstimate, error)

EstimateQuery is unsupported: Db2's EXPLAIN writes into explain tables the user has to create first, and reads back from them.

func (*Db2Scrapper) Executor

func (e *Db2Scrapper) Executor() *dwhexecdb2.Db2Executor

func (*Db2Scrapper) FetchQueryLogs

func (e *Db2Scrapper) FetchQueryLogs(
	ctx context.Context,
	from, to time.Time,
	obfuscator querylogs.QueryObfuscator,
) (querylogs.QueryLogIterator, error)

FetchQueryLogs reads the package cache (MON_GET_PKG_CACHE_STMT): one entry per cached statement, with metrics accumulated over its executions, for the statements whose metrics were last updated in [from, to). Like Oracle's V$SQL, it holds no per-execution history and no executing user, and a statement ages out under memory pressure. Needs EXECUTE on MON_GET_PKG_CACHE_STMT.

func (*Db2Scrapper) IsPermissionError

func (e *Db2Scrapper) IsPermissionError(err error) bool

func (*Db2Scrapper) QueryCatalog

func (e *Db2Scrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)

func (*Db2Scrapper) QueryCustomMetrics

func (e *Db2Scrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)

func (*Db2Scrapper) QueryDatabases

func (e *Db2Scrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)

func (*Db2Scrapper) QuerySchemas

func (e *Db2Scrapper) QuerySchemas(ctx context.Context) ([]*scrapper.SchemaRow, error)

func (*Db2Scrapper) QuerySegments

func (e *Db2Scrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)

func (*Db2Scrapper) QueryShape

func (e *Db2Scrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)

func (*Db2Scrapper) QuerySqlDefinitions

func (e *Db2Scrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)

func (*Db2Scrapper) QueryTableConstraints

func (e *Db2Scrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)

func (*Db2Scrapper) QueryTableMetrics

func (e *Db2Scrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)

func (*Db2Scrapper) QueryTables

func (e *Db2Scrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)

func (*Db2Scrapper) RunRawQuery

func (e *Db2Scrapper) RunRawQuery(ctx context.Context, sql string) (scrapper.RawQueryRowIterator, error)

func (*Db2Scrapper) SqlDialect

func (e *Db2Scrapper) SqlDialect() sqldialect.Dialect

func (*Db2Scrapper) ValidateConfiguration

func (e *Db2Scrapper) ValidateConfiguration(ctx context.Context) ([]string, error)

type Db2ScrapperConf

type Db2ScrapperConf struct {
	dwhexecdb2.Db2Conf
}

Db2ScrapperConf configures a scrapper for IBM Db2 for Linux, UNIX and Windows. Db2 for z/OS and Db2 for i keep their catalogs elsewhere (SYSIBM.SYS*, QSYS2) and are not supported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL