github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/stats/table_statistic.proto (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 // 11 // Data structures and basic infrastructure for distributed SQL APIs. See 12 // docs/RFCS/distributed_sql.md. 13 // All the concepts here are "physical plan" concepts. 14 15 syntax = "proto3"; 16 package cockroach.sql.stats; 17 option go_package = "stats"; 18 19 import "gogoproto/gogo.proto"; 20 import "google/protobuf/timestamp.proto"; 21 22 import "sql/stats/histogram.proto"; 23 24 // A TableStatisticProto object holds a statistic for a particular column or 25 // group of columns. It mirrors the structure of the system.table_statistics 26 // table. It is also used as the format in which table statistics are 27 // serialized in a backup. 28 message TableStatisticProto { 29 // The ID of the table. 30 uint32 table_id = 1 [(gogoproto.customname) = "TableID", 31 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ID"]; 32 // The ID for this statistic. It need not be globally unique, 33 // but must be unique for this table. 34 uint64 statistic_id = 2 [(gogoproto.customname) = "StatisticID"]; 35 // Optional user-defined name for the statistic. 36 string name = 3; 37 // The column ID(s) for which this statistic is generated. 38 repeated uint32 column_ids = 4 [(gogoproto.customname) = "ColumnIDs", 39 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sqlbase.ColumnID"]; 40 // The time at which the statistic was created. 41 google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; 42 // The total number of rows in the table. 43 uint64 row_count = 6; 44 // The estimated number of distinct values of the columns in ColumnIDs. 45 uint64 distinct_count = 7; 46 // The number of rows that have a NULL in all of the columns in ColumnIDs. 47 uint64 null_count = 8; 48 // Histogram (if available) 49 HistogramData histogram_data = 9; 50 }