Skip to content

Collect telemetry using feature counters when someone executes a transaction with a mix of DDL and DML #115012

@dikshant

Description

@dikshant

We need to understand the extent at which our customers are using or trying to use DDL and DML statements in a single transactions. For example this simple case is supported:

root@localhost:26257/system/defaultdb> CREATE TABLE t (a INT);
CREATE TABLE

Time: 48ms total (execution 48ms / network 0ms)

root@localhost:26257/system/defaultdb> BEGIN;
BEGIN

Time: 0ms total (execution 1ms / network 0ms)

root@localhost:26257/system/defaultdb  OPEN> ALTER TABLE t ADD COLUMN b INT;
ALTER TABLE

Time: 16ms total (execution 16ms / network 0ms)

root@localhost:26257/system/defaultdb  OPEN> INSERT INTO t (a) VALUES (1);
INSERT 0 1

Time: 4ms total (execution 4ms / network 0ms)

root@localhost:26257/system/defaultdb  OPEN> COMMIt;
COMMIT

Time: 582ms total (execution 582ms / network 0ms)

root@localhost:26257/system/defaultdb> SELECT * FROM t;
  a |  b
----+-------
  1 | NULL
(1 row)

Time: 1ms total (execution 0ms / network 0ms)

In such cases we should emit telemetry for a feature counter: sql.schema.ddl_dml_transaction_success

If there are cases where we emit a warning or do not support we should also log:
sql.schema.ddl_dml_transaction_failure

We should also measure DDL only transactions:
sql.schema.ddl_transaction_success

Similarly for failures
sql.schema.ddl_transaction_failure

Jira issue: CRDB-33841

Epic CRDB-31282

Metadata

Metadata

Assignees

Labels

A-schema-changesC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)v23.1.14v23.2.1

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions