github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/logictest/testdata/logic_test/distsql_event_log (about)

     1  # LogicTest: 5node 5node-metadata
     2  
     3  ###################
     4  # CREATE STATISTICS
     5  ###################
     6  
     7  statement ok
     8  SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false
     9  
    10  # This test verifies that events are posted for table statistics creation.
    11  statement ok
    12  SET CLUSTER SETTING sql.stats.post_events.enabled = TRUE
    13  
    14  statement ok
    15  CREATE TABLE a (id INT PRIMARY KEY, x INT, y INT, INDEX x_idx (x, y))
    16  
    17  statement ok
    18  CREATE STATISTICS s1 ON id FROM a
    19  
    20  statement ok
    21  CREATE STATISTICS __auto__ FROM a
    22  
    23  query IIT
    24  SELECT "targetID", "reportingID", "info"
    25  FROM system.eventlog
    26  WHERE "eventType" = 'create_statistics'
    27  ORDER BY "timestamp"
    28  ----
    29  53  1  {"TableName":"test.public.a","Statement":"CREATE STATISTICS s1 ON id FROM a"}
    30  53  1  {"TableName":"test.public.a","Statement":"CREATE STATISTICS __auto__ FROM a"}
    31  
    32  statement ok
    33  DROP TABLE a