Skip to content

[YSQL] Add Json-compatible histogram to YsqlStatementStat  #17696

@acuskev

Description

@acuskev

Jira Link: DB-6803

Description

#14445 added the yb_latency_histogram column to the pg_stat_statements view. We want to extend this functionality to the output of SQL server / statements. Currently the output resembles:
{ "statements": [ { "query_id": 6810743978840536510, "query": "create table t1 as select i from generate_series(1, 1000) i", "calls": 1, "total_time": 169.233163, "min_time": 169.233163, "max_time": 169.233163, "mean_time": 169.233163, "stddev_time": 0.0, "rows": 0 }, { "query_id": -3987609402916575485, "query": "create table t3 as select i from generate_series(1, 100000) i", "calls": 1, "total_time": 1334.519109, "min_time": 1334.519109, "max_time": 1334.519109, "mean_time": 1334.519109, "stddev_time": 0.0, "rows": 0 }, ... ] }
This task will add a histogram field to YsqlStatementStat. This histogram field will then be written to Json and returned like the other fields in the above output, one histogram for each list entry. This task may require changes in pg_stat_statements.c and pgsql_webserver_wrapper.cc to convert the histogram struct to string or Json, and handle writing the new field.

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.

Metadata

Metadata

Assignees

Labels

area/ysqlYugabyte SQL (YSQL)kind/enhancementThis is an enhancement of an existing featurepriority/mediumMedium priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions