From 47a4ca1e59a2f38b8de6c352f5360b1a67505a1d Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Wed, 14 Dec 2022 22:45:18 +0100 Subject: [PATCH] sql: enhance SHOW RANGES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TLDR: - hide broken columns from crdb_internal.ranges{,no_leases} - use crdb_internal.index_spans, .table_spans instead - rework SHOW RANGES. - select between "1 row per range" and "1 row per range/object intersection" using new syntax - fix representation of start/end key (see text of release notes below for details) To test this, use for example the following setup: ``` > -- Enable merge of adjacent ranges with same zone config. > set cluster setting spanconfig.host_coalesce_adjacent.enabled = true; > -- Table t has two indexes with some split points. > create table t(x int primary key, y int); > create index sec_idx on t(y); > alter index t@primary split at values(3); > alter index t@sec_idx split at values(3); > -- Tables u and v share a range with t@sec_idx. > create table u(x int); > create table v(x int); > -- Make some other tables with forced split points due to different > -- zone configs. > create schema otherschema; > create table otherschema.w(x int); > create table otherschema.z(x int); > alter table otherschema.w configure zone using num_replicas = 5; > alter table otherschema.z configure zone using num_replicas = 7; ``` Example output for `SHOW RANGES FROM DATABASE`: ``` > show ranges from database defaultdb; -- 1 row per range > show ranges from current_catalog; -- implicit db from session start_key | end_key | range_id | ... -----------------+----------------+----------+---- /Table/104 | /Table/104/1/3 | 56 | ... /Table/104/1/3 | /Table/104/2 | 57 | ... /Table/104/2 | /Table/104/2/3 | 55 | ... /Table/104/2/3 | /Table/108 | 58 | ... /Table/108 | /Table/109 | 59 | ... /Table/109 | /Max | 60 | ... ``` New syntax: `WITH TABLES` / `WITH INDEXES`: ``` > show ranges from database defaultdb with tables; -- 1 row per range/table intersection start_key | end_key | range_id | schema_name | table_name | table_start_key | table_end_key | ... -----------------+----------------+----------+-------------+------------+-----------------+----------------------+---- /Table/104 | /Table/104/1/3 | 56 | public | t | /Table/104 | /Table/105 | ... /Table/104/1/3 | /Table/104/2 | 57 | public | t | /Table/104 | /Table/105 | ... /Table/104/2 | /Table/104/2/3 | 55 | public | t | /Table/104 | /Table/105 | ... /Table/104/2/3 | /Table/108 | 58 | public | t | /Table/104 | /Table/105 | ... /Table/104/2/3 | /Table/108 | 58 | public | u | /Table/105 | /Table/106 | ... /Table/104/2/3 | /Table/108 | 58 | public | v | /Table/106 | /Table/107 | ... /Table/108 | /Table/109 | 59 | otherschema | w | /Table/108 | /Table/109 | ... /Table/109 | /Max | 60 | otherschema | z | /Table/109 | /Table/109/PrefixEnd | ... ``` ``` > show ranges from database defaultdb with indexes; -- 1 row per range/index intersection start_key | end_key | range_id | schema_name | table_name | index_name | index_start_key | index_end_key | ... -----------------+----------------+----------+-------------+------------+------------+-----------------+---------------+---- /Table/104 | /Table/104/1/3 | 56 | public | t | t_pkey | /Table/104/1 | /Table/104/2 | ... /Table/104/1/3 | /Table/104/2 | 57 | public | t | t_pkey | /Table/104/1 | /Table/104/2 | ... /Table/104/2 | /Table/104/2/3 | 55 | public | t | sec_idx | /Table/104/2 | /Table/104/3 | ... /Table/104/2/3 | /Table/108 | 58 | public | t | sec_idx | /Table/104/2 | /Table/104/3 | ... /Table/104/2/3 | /Table/108 | 58 | public | u | u_pkey | /Table/105/1 | /Table/105/2 | ... /Table/104/2/3 | /Table/108 | 58 | public | v | v_pkey | /Table/106/1 | /Table/106/2 | ... /Table/108 | /Table/109 | 59 | otherschema | w | w_pkey | /Table/108/1 | /Table/108/2 | ... /Table/109 | /Max | 60 | otherschema | z | z_pkey | /Table/109/1 | /Table/109/2 | ... ``` Example output for `SHOW RANGES FROM TABLE`: ``` > show ranges from table t; start_key | end_key | range_id | ... ---------------+--------------------+----------+---- …/ | …/1/3 | 56 | ... …/1/3 | …/2 | 57 | ... …/2 | …/2/3 | 55 | ... …/2/3 | | 58 | ... ``` ``` > show ranges from table u; start_key | end_key | range_id | ... --------------------------+--------------------+----------+---- | | 58 | ... ``` ``` > show ranges from table otherschema.w; start_key | end_key | range_id | ... ---------------+--------------+----------+---- …/ | …/ | 59 | ... ``` New syntax: `SHOW RANGES FROM TABLE ... WITH INDEXES`: ``` > show ranges from table t with indexes; start_key | end_key | range_id | index_name | index_start_key | index_end_key | ... ---------------+--------------------+----------+------------+-----------------+---------------+---- …/ | …/1/3 | 56 | t_pkey | …/1 | …/2 | ... …/1/3 | …/ | 57 | t_pkey | …/1 | …/2 | ... …/ | …/2/3 | 55 | sec_idx | …/2 | …/3 | ... …/2/3 | | 58 | sec_idx | …/2 | …/3 | ... ``` ``` > show ranges from table u with indexes; start_key | end_key | range_id | index_name | index_start_key | index_end_key | ... --------------------------+--------------------+----------+------------+-----------------+---------------+---- | | 58 | u_pkey | …/1 | …/2 | ... ``` ``` > show ranges from table otherschema.w with indexes; start_key | end_key | range_id | index_name | index_start_key | index_end_key | ... ---------------+--------------+----------+------------+-----------------+---------------+---- …/ | …/ | 59 | w_pkey | …/1 | …/2 | ... ``` Example output for `SHOW RANGES FROM INDEX`: ``` > show ranges from index t@t_pkey; start_key | end_key | range_id | ... ---------------+--------------+----------+---- …/ | …/3 | 56 | ... …/3 | …/ | 57 | ... ``` ``` > show ranges from index t@sec_idx; start_key | end_key | range_id | ... ---------------+--------------------+----------+---- …/ | …/3 | 55 | ... …/3 | | 58 | ... ``` ``` > show ranges from index u@u_pkey; start_key | end_key | range_id | ... --------------------------+--------------------+----------+---- | | 58 | ... ``` ``` > show ranges from index otherschema.w@w_pkey; start_key | end_key | range_id | ... ---------------+--------------+----------+---- …/ | …/ | 59 | ... ``` See release notes below for details. ---- Release note (backward-incompatible change): CockroachDB now supports sharing storage ranges across multiple indexes/tables. As a result, there is no more guarantee that there is at most one SQL object (e.g. table/index/sequence/materialized view) per storage range. Therefore, the columns `table_id`, `database_name`, `schema_name`, `table_name` and `index_name` in `crdb_internal.ranges` and `.ranges_no_leases` have become nonsensical: a range cannot be attributed to a single table/index any more. As a result: - The aforementioned columns in the `crdb_internal` virtual tables have been marked as hidden, and will now report NULL. - `SHOW RANGES FROM DATABASE` continues to report one row per range, but stops returning the database / schema / table / index name. - `SHOW RANGES FROM TABLE` continues to report one row per range, but stops returning the index name. Summary: | Statement | Row identity | Before | After | |----------------------------------------------------|----------------------------------|----------------------------|----------------------------------| | `SHOW RANGES FROM DATABASE` | rangeID | Includes schema/table name | (NEW) No schema/table name | | `SHOW RANGES FROM TABLE` | rangeID | Includes index name | (NEW) No index name | | `SHOW RANGES FROM INDEX` | rangeID | Includes index name | Unchanged | | `SHOW RANGES FROM DATABASE ... WITH TABLES` (NEW) | rangeID, schema/table name | N/A | Includes schema/table name | | `SHOW RANGES FROM DATABASE ... WITH INDEXES` (NEW) | rangeID, schema/table/index name | N/A | Includes schema/table/index name | | `SHOW RANGES FROM TABLE ... WITH INDEXES` (NEW) | rangeID, index name | N/A | Includes index name | Release note (backward-incompatible change): The format of the columns `start_key` and `end_key` for `SHOW RANGES FROM DATABASE` and `SHOW RANGES FROM TABLE` have been extended to include which table/index the key belong to. This is necessary because a range can now contain data from more than one table/index. Summary: | Statement | Start/end key column, before | Start/end key column, after | |----------------------------------------------------|------------------------------|---------------------------------------| | `SHOW RANGES FROM DATABASE` | Truncates table/index IDs | (NEW) Includes table/index ID | | `SHOW RANGES FROM TABLE` | Truncates table/index IDs | (NEW) Includes table/index ID | | `SHOW RANGES FROM INDEX` | Truncates table/index IDs | Unchanged | | `SHOW RANGES FROM DATABASE ... WITH TABLES` (NEW) | N/A | Includes table/index ID | | `SHOW RANGES FROM DATABASE ... WITH INDEXES` (NEW) | N/A | Includes table/index ID | | `SHOW RANGES FROM TABLE ... WITH INDEXES` (NEW) | N/A | Truncates table ID, includes index ID | Release note (backward-incompatible change): The format of the columns `start_key` and `end_key` for `SHOW RANGE ... FOR ROW` has been changed to stay consistent with the output of `SHOW RANGES FROM INDEX`. Release note (bug fix): In some cases the start/end key columns of the output of `SHOW RANGES` was missing. This was corrected. Release note (sql change): Two new virtual tables `crdb_internal.index_spans` and `.table_spans` have been introduced, which list the logical keyspace used by each index/table. Release note (sql change): The following new statements are introduced: - `SHOW RANGES FROM CURRENT_CATALOG`: alias for `SHOW RANGES FROM DATABASE` on the session's current database. - `SHOW RANGES FROM DATABASE ... WITH TABLES` Reports at least one row per table. It's possible for the same range ID to be repeated across multiple rows, when a range spans multiple tables. - `SHOW RANGES FROM DATABASE ... WITH INDEXES` Reports at least one row per index. It's possible for the same range ID to be repeated across multiple rows, when a range spans multiple indexes. - `SHOW RANGES FROM TABLE ... WITH INDEXES` Reports at least one row per index. It's possible for the same range ID to be repeated across multiple rows, when a range spans multiple indexes. Under the hood, these statements are implemented by means of a join between `crdb_internal.ranges` and `crdb_internal.{index,table}_spans`. --- docs/generated/sql/bnf/show_ranges_stmt.bnf | 10 +- docs/generated/sql/bnf/stmt_block.bnf | 10 +- .../testdata/logic_test/crdb_internal_tenant | 2 + .../partitioning_hash_sharded_index | 48 +- .../logic_test/regional_by_row_query_behavior | 18 +- pkg/sql/crdb_internal.go | 139 ++- pkg/sql/delegate/show_range_for_row.go | 12 +- pkg/sql/delegate/show_ranges.go | 377 +++++++-- pkg/sql/distsql_physical_planner_test.go | 16 +- pkg/sql/importer/import_into_test.go | 10 +- .../testdata/logic_test/cluster_locks | 14 +- .../testdata/logic_test/crdb_internal | 26 +- .../testdata/logic_test/dist_vectorize | 24 +- .../logictest/testdata/logic_test/distsql_agg | 44 +- .../testdata/logic_test/distsql_crdb_internal | 22 +- .../testdata/logic_test/distsql_distinct_on | 26 +- .../testdata/logic_test/distsql_numtables | 16 +- .../testdata/logic_test/distsql_subquery | 6 +- .../testdata/logic_test/distsql_union | 12 +- .../logictest/testdata/logic_test/grant_table | 2 + .../testdata/logic_test/hash_sharded_index | 26 +- .../testdata/logic_test/information_schema | 11 + .../logic_test/inverted_join_geospatial_dist | 8 +- .../logic_test/kv_builtin_functions_local | 2 +- .../testdata/logic_test/merge_join_dist | 16 +- .../logictest/testdata/logic_test/pg_builtins | 72 +- .../logictest/testdata/logic_test/pg_catalog | 796 +++++++++--------- .../logictest/testdata/logic_test/show_source | 14 +- .../logictest/testdata/logic_test/split_at | 12 +- .../logictest/testdata/logic_test/sql_keys | 4 +- pkg/sql/logictest/testdata/logic_test/table | 2 + pkg/sql/multitenant_admin_function_test.go | 9 +- .../exec/execbuilder/testdata/dist_vectorize | 24 +- .../opt/exec/execbuilder/testdata/distsql_agg | 66 +- .../execbuilder/testdata/distsql_distinct_on | 26 +- .../execbuilder/testdata/distsql_indexjoin | 12 +- .../testdata/distsql_inverted_index | 32 +- .../exec/execbuilder/testdata/distsql_join | 22 +- .../execbuilder/testdata/distsql_merge_join | 52 +- .../exec/execbuilder/testdata/distsql_misc | 22 +- .../execbuilder/testdata/distsql_numtables | 16 +- .../execbuilder/testdata/distsql_ordinality | 12 +- .../testdata/distsql_tighten_spans | 30 +- .../exec/execbuilder/testdata/distsql_union | 12 +- .../exec/execbuilder/testdata/distsql_window | 22 +- .../experimental_distsql_planning_5node | 28 +- .../testdata/explain_analyze_plans | 28 +- .../testdata/inverted_filter_geospatial_dist | 22 +- .../testdata/inverted_filter_json_array_dist | 16 +- .../testdata/inverted_join_geospatial_dist | 8 +- .../inverted_join_geospatial_dist_vec | 8 +- .../testdata/inverted_join_json_array_dist | 14 +- .../testdata/inverted_join_multi_column_dist | 16 +- .../opt/exec/execbuilder/testdata/lookup_join | 26 +- .../execbuilder/testdata/merge_join_dist_vec | 16 +- .../exec/execbuilder/testdata/scan_parallel | 22 +- pkg/sql/parser/sql.y | 82 +- pkg/sql/parser/testdata/show | 145 ++++ pkg/sql/scatter_test.go | 3 +- pkg/sql/sem/catconstants/constants.go | 2 + pkg/sql/sem/tree/show.go | 97 ++- pkg/sql/tests/truncate_test.go | 4 +- pkg/sql/unsplit.go | 31 +- 63 files changed, 1690 insertions(+), 1032 deletions(-) diff --git a/docs/generated/sql/bnf/show_ranges_stmt.bnf b/docs/generated/sql/bnf/show_ranges_stmt.bnf index 684a456f8d9d..9430d39d03fd 100644 --- a/docs/generated/sql/bnf/show_ranges_stmt.bnf +++ b/docs/generated/sql/bnf/show_ranges_stmt.bnf @@ -1,4 +1,10 @@ show_ranges_stmt ::= - 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name - | 'SHOW' 'RANGES' 'FROM' 'INDEX' table_index_name + 'SHOW' 'RANGES' 'FROM' 'INDEX' table_index_name + | 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name + | 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name 'WITH' 'INDEXES' | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' + | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name 'WITH' 'TABLES' + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' 'WITH' 'TABLES' + | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name 'WITH' 'INDEXES' + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' 'WITH' 'INDEXES' diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 29a345602b7b..b0a6d39b9414 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -867,9 +867,15 @@ show_statements_stmt ::= | 'SHOW' 'ALL' opt_cluster statements_or_queries show_ranges_stmt ::= - 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name - | 'SHOW' 'RANGES' 'FROM' 'INDEX' table_index_name + 'SHOW' 'RANGES' 'FROM' 'INDEX' table_index_name + | 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name + | 'SHOW' 'RANGES' 'FROM' 'TABLE' table_name 'WITH' 'INDEXES' | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' + | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name 'WITH' 'TABLES' + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' 'WITH' 'TABLES' + | 'SHOW' 'RANGES' 'FROM' 'DATABASE' database_name 'WITH' 'INDEXES' + | 'SHOW' 'RANGES' 'FROM' 'CURRENT_CATALOG' 'WITH' 'INDEXES' show_range_for_row_stmt ::= 'SHOW' 'RANGE' 'FROM' 'TABLE' table_name 'FOR' 'ROW' '(' expr_list ')' diff --git a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant index 333cd351a753..cd89a00b069f 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant +++ b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant @@ -54,6 +54,7 @@ crdb_internal gossip_liveness table admin NULL NULL crdb_internal gossip_network table admin NULL NULL crdb_internal gossip_nodes table admin NULL NULL crdb_internal index_columns table admin NULL NULL +crdb_internal index_spans table admin NULL NULL crdb_internal index_usage_statistics table admin NULL NULL crdb_internal invalid_objects table admin NULL NULL crdb_internal jobs table admin NULL NULL @@ -92,6 +93,7 @@ crdb_internal super_regions table admin NULL NULL crdb_internal table_columns table admin NULL NULL crdb_internal table_indexes table admin NULL NULL crdb_internal table_row_statistics table admin NULL NULL +crdb_internal table_spans table admin NULL NULL crdb_internal tables table admin NULL NULL crdb_internal tenant_usage_details view admin NULL NULL crdb_internal transaction_contention_events table admin NULL NULL diff --git a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index index 987f86f88d2b..ad4216de35fa 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index +++ b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index @@ -256,29 +256,27 @@ statement ok CREATE INDEX t_presplit_idx_member_id ON t_presplit (member_id) USING HASH WITH (bucket_count=8); skipif config 3node-tenant -query TITTT colnames,retry -SELECT t.name, r.table_id, r.index_name, r.start_pretty, r.end_pretty -FROM crdb_internal.tables t -JOIN crdb_internal.ranges r ON t.table_id = r.table_id -WHERE t.name = 't_presplit' -AND t.state = 'PUBLIC' -AND r.split_enforced_until IS NOT NULL; +query TITTT colnames,retry,rowsort +SELECT table_name, table_id, index_name, start_key, end_key + FROM [SHOW RANGES FROM DATABASE test WITH INDEXES] + WHERE table_name = 't_presplit' ---- -name table_id index_name start_pretty end_pretty -t_presplit 112 t_presplit_idx_member_id /Table/112/2 /Table/112/2/"new york"/0 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/0 /Table/112/2/"new york"/1 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/1 /Table/112/2/"new york"/2 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/2 /Table/112/2/"new york"/3 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/3 /Table/112/2/"new york"/4 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/4 /Table/112/2/"new york"/5 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/5 /Table/112/2/"new york"/6 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/6 /Table/112/2/"new york"/7 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/7 /Table/112/2/"seattle"/0 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/0 /Table/112/2/"seattle"/1 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/1 /Table/112/2/"seattle"/2 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/2 /Table/112/2/"seattle"/3 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/3 /Table/112/2/"seattle"/4 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/4 /Table/112/2/"seattle"/5 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/5 /Table/112/2/"seattle"/6 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/6 /Table/112/2/"seattle"/7 -t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/7 /Table/112/3/"new york"/0 +table_name table_id index_name start_key end_key +t_presplit 112 t_presplit_pkey /Table/109/11/"seattle"/15 /Table/112/2 +t_presplit 112 t_presplit_idx_member_id /Table/112/2 /Table/112/2/"new york"/0 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/0 /Table/112/2/"new york"/1 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/1 /Table/112/2/"new york"/2 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/2 /Table/112/2/"new york"/3 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/3 /Table/112/2/"new york"/4 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/4 /Table/112/2/"new york"/5 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/5 /Table/112/2/"new york"/6 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/6 /Table/112/2/"new york"/7 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"new york"/7 /Table/112/2/"seattle"/0 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/0 /Table/112/2/"seattle"/1 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/1 /Table/112/2/"seattle"/2 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/2 /Table/112/2/"seattle"/3 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/3 /Table/112/2/"seattle"/4 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/4 /Table/112/2/"seattle"/5 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/5 /Table/112/2/"seattle"/6 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/6 /Table/112/2/"seattle"/7 +t_presplit 112 t_presplit_idx_member_id /Table/112/2/"seattle"/7 /Table/112/3/"new york"/0 diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior index 2dde13f0ba99..37105d875954 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior @@ -262,7 +262,7 @@ ap-southeast-2 23 query TT SELECT start_key, end_key FROM [SHOW RANGE FROM TABLE regional_by_row_table FOR ROW ('ap-southeast-2', 1)] ---- -NULL NULL + query TIIII SELECT crdb_region, pk, pk2, a, b FROM regional_by_row_table @@ -394,10 +394,10 @@ ALTER TABLE regional_by_row_table EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 'ap-so query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX regional_by_row_table@primary] ---- -start_key end_key replicas lease_holder -NULL /"\x80"/0 {1} 1 -/"\x80"/0 /"\xc0"/0 {4} 4 -/"\xc0"/0 NULL {7} 7 +start_key end_key replicas lease_holder + …/"\x80"/0 {1} 1 +…/"\x80"/0 …/"\xc0"/0 {4} 4 +…/"\xc0"/0 {7} 7 statement ok SET locality_optimized_partitioned_index_scan = false @@ -642,10 +642,10 @@ ALTER TABLE child EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 'ap-southeast-2', 0), query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX child@primary] ---- -start_key end_key replicas lease_holder -NULL /"\x80"/0 {1} 1 -/"\x80"/0 /"\xc0"/0 {4} 4 -/"\xc0"/0 NULL {7} 7 +start_key end_key replicas lease_holder + …/"\x80"/0 {1} 1 +…/"\x80"/0 …/"\xc0"/0 {4} 4 +…/"\xc0"/0 {7} 7 statement ok SET locality_optimized_partitioned_index_scan = false diff --git a/pkg/sql/crdb_internal.go b/pkg/sql/crdb_internal.go index 54b9d02ddf67..29e55b5e7868 100644 --- a/pkg/sql/crdb_internal.go +++ b/pkg/sql/crdb_internal.go @@ -65,6 +65,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/builtins" "github.com/cockroachdb/cockroach/pkg/sql/sem/builtins/builtinsregistry" "github.com/cockroachdb/cockroach/pkg/sql/sem/catconstants" + "github.com/cockroachdb/cockroach/pkg/sql/sem/catid" "github.com/cockroachdb/cockroach/pkg/sql/sem/eval" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -140,6 +141,7 @@ var crdbInternal = virtualSchema{ catconstants.CrdbInternalGossipNetworkTableID: crdbInternalGossipNetworkTable, catconstants.CrdbInternalTransactionContentionEvents: crdbInternalTransactionContentionEventsTable, catconstants.CrdbInternalIndexColumnsTableID: crdbInternalIndexColumnsTable, + catconstants.CrdbInternalIndexSpansTableID: crdbInternalIndexSpansTable, catconstants.CrdbInternalIndexUsageStatisticsTableID: crdbInternalIndexUsageStatistics, catconstants.CrdbInternalInflightTraceSpanTableID: crdbInternalInflightTraceSpanTable, catconstants.CrdbInternalJobsTableID: crdbInternalJobsTable, @@ -165,6 +167,7 @@ var crdbInternal = virtualSchema{ catconstants.CrdbInternalStmtStatsTableID: crdbInternalStmtStatsView, catconstants.CrdbInternalTableColumnsTableID: crdbInternalTableColumnsTable, catconstants.CrdbInternalTableIndexesTableID: crdbInternalTableIndexesTable, + catconstants.CrdbInternalTableSpansTableID: crdbInternalTableSpansTable, catconstants.CrdbInternalTablesTableLastStatsID: crdbInternalTablesTableLastStats, catconstants.CrdbInternalTablesTableID: crdbInternalTablesTable, catconstants.CrdbInternalClusterTxnStatsTableID: crdbInternalClusterTxnStatsTable, @@ -3533,11 +3536,11 @@ FROM crdb_internal.ranges_no_leases {Name: "start_pretty", Typ: types.String}, {Name: "end_key", Typ: types.Bytes}, {Name: "end_pretty", Typ: types.String}, - {Name: "table_id", Typ: types.Int}, - {Name: "database_name", Typ: types.String}, - {Name: "schema_name", Typ: types.String}, - {Name: "table_name", Typ: types.String}, - {Name: "index_name", Typ: types.String}, + {Hidden: true, Name: "table_id", Typ: types.Int}, + {Hidden: true, Name: "database_name", Typ: types.String}, + {Hidden: true, Name: "schema_name", Typ: types.String}, + {Hidden: true, Name: "table_name", Typ: types.String}, + {Hidden: true, Name: "index_name", Typ: types.String}, {Name: "replicas", Typ: types.Int2Vector}, {Name: "replica_localities", Typ: types.StringArray}, {Name: "voting_replicas", Typ: types.Int2Vector}, @@ -3653,11 +3656,11 @@ CREATE TABLE crdb_internal.ranges_no_leases ( start_pretty STRING NOT NULL, end_key BYTES NOT NULL, end_pretty STRING NOT NULL, - table_id INT NOT NULL, - database_name STRING NOT NULL, - schema_name STRING NOT NULL, - table_name STRING NOT NULL, - index_name STRING NOT NULL, + table_id INT NOT VISIBLE, + database_name STRING NOT VISIBLE, + schema_name STRING NOT VISIBLE, + table_name STRING NOT VISIBLE, + index_name STRING NOT VISIBLE, replicas INT[] NOT NULL, replica_localities STRING[] NOT NULL, voting_replicas INT[] NOT NULL, @@ -3685,9 +3688,13 @@ CREATE TABLE crdb_internal.ranges_no_leases ( return p.CheckPrivilege(ctx, desc, privilege.ZONECONFIG) == nil } - hasPermission, dbNames, tableNames, schemaNames, indexNames, schemaParents, parents := - descriptorsByType(descs, privCheckerFunc) - + hasPermission := false + for _, desc := range descs { + if privCheckerFunc(desc) { + hasPermission = true + break + } + } // if the user has no ZONECONFIG privilege on any table/schema/database if !hasPermission { return nil, nil, pgerror.Newf(pgcode.InsufficientPrivilege, "only users with the ZONECONFIG privilege or the admin role can read crdb_internal.ranges_no_leases") @@ -3763,11 +3770,6 @@ CREATE TABLE crdb_internal.ranges_no_leases ( } } - tableID, dbName, schemaName, tableName, indexName := lookupNamesByKey( - p, rangeDesc.StartKey.AsRawKey(), dbNames, tableNames, schemaNames, - indexNames, schemaParents, parents, - ) - splitEnforcedUntil := tree.DNull if !rangeDesc.StickyBit.IsEmpty() { splitEnforcedUntil = eval.TimestampToInexactDTimestamp(rangeDesc.StickyBit) @@ -3779,11 +3781,11 @@ CREATE TABLE crdb_internal.ranges_no_leases ( tree.NewDString(keys.PrettyPrint(nil /* valDirs */, rangeDesc.StartKey.AsRawKey())), tree.NewDBytes(tree.DBytes(rangeDesc.EndKey)), tree.NewDString(keys.PrettyPrint(nil /* valDirs */, rangeDesc.EndKey.AsRawKey())), - tree.NewDInt(tree.DInt(tableID)), - tree.NewDString(dbName), - tree.NewDString(schemaName), - tree.NewDString(tableName), - tree.NewDString(indexName), + tree.DNull, // tableID + tree.DNull, // dbName + tree.DNull, // schemaName + tree.DNull, // tableName + tree.DNull, // indexName votersAndNonVotersArr, replicaLocalityArr, votersArr, @@ -6350,6 +6352,95 @@ CREATE TABLE crdb_internal.transaction_contention_events ( }, } +var crdbInternalIndexSpansTable = virtualSchemaTable{ + comment: `key spans per table index`, + schema: ` +CREATE TABLE crdb_internal.index_spans ( + descriptor_id INT NOT NULL, + index_id INT NOT NULL, + start_key BYTES NOT NULL, + end_key BYTES NOT NULL, + INDEX(descriptor_id) +);`, + indexes: []virtualIndex{ + { + populate: func(ctx context.Context, constraint tree.Datum, p *planner, db catalog.DatabaseDescriptor, addRow func(...tree.Datum) error) (matched bool, err error) { + descID := catid.DescID(tree.MustBeDInt(constraint)) + table, err := p.LookupTableByID(ctx, descID) + if err != nil { + return false, err + } + return true, generateIndexSpans(ctx, p, table, addRow) + }, + }, + }, + populate: func(ctx context.Context, p *planner, db catalog.DatabaseDescriptor, addRow func(...tree.Datum) error) error { + return forEachTableDescAll(ctx, p, db, hideVirtual, + func(_ catalog.DatabaseDescriptor, _ catalog.SchemaDescriptor, table catalog.TableDescriptor) error { + return generateIndexSpans(ctx, p, table, addRow) + }) + }, +} + +func generateIndexSpans( + ctx context.Context, p *planner, table catalog.TableDescriptor, addRow func(...tree.Datum) error, +) error { + tabID := table.GetID() + return catalog.ForEachIndex(table, catalog.IndexOpts{}, func(idx catalog.Index) error { + indexID := idx.GetID() + start := roachpb.Key(rowenc.MakeIndexKeyPrefix(p.ExecCfg().Codec, tabID, indexID)) + end := start.PrefixEnd() + return addRow( + tree.NewDInt(tree.DInt(tabID)), + tree.NewDInt(tree.DInt(indexID)), + tree.NewDBytes(tree.DBytes(start)), + tree.NewDBytes(tree.DBytes(end)), + ) + }) +} + +var crdbInternalTableSpansTable = virtualSchemaTable{ + comment: `key spans per SQL object`, + schema: ` +CREATE TABLE crdb_internal.table_spans ( + descriptor_id INT NOT NULL, + start_key BYTES NOT NULL, + end_key BYTES NOT NULL, + INDEX(descriptor_id) +);`, + indexes: []virtualIndex{ + { + populate: func(ctx context.Context, constraint tree.Datum, p *planner, db catalog.DatabaseDescriptor, addRow func(...tree.Datum) error) (matched bool, err error) { + descID := catid.DescID(tree.MustBeDInt(constraint)) + table, err := p.LookupTableByID(ctx, descID) + if err != nil { + return false, err + } + return true, generateTableSpan(ctx, p, table, addRow) + }, + }, + }, + populate: func(ctx context.Context, p *planner, db catalog.DatabaseDescriptor, addRow func(...tree.Datum) error) error { + return forEachTableDescAll(ctx, p, db, hideVirtual, + func(_ catalog.DatabaseDescriptor, _ catalog.SchemaDescriptor, table catalog.TableDescriptor) error { + return generateTableSpan(ctx, p, table, addRow) + }) + }, +} + +func generateTableSpan( + ctx context.Context, p *planner, table catalog.TableDescriptor, addRow func(...tree.Datum) error, +) error { + tabID := table.GetID() + start := p.ExecCfg().Codec.TablePrefix(uint32(tabID)) + end := start.PrefixEnd() + return addRow( + tree.NewDInt(tree.DInt(tabID)), + tree.NewDBytes(tree.DBytes(start)), + tree.NewDBytes(tree.DBytes(end)), + ) +} + // crdbInternalClusterLocksTable exposes the state of locks, as well as lock waiters, // in range lock tables across the cluster. var crdbInternalClusterLocksTable = virtualSchemaTable{ @@ -6360,7 +6451,7 @@ CREATE TABLE crdb_internal.cluster_locks ( range_id INT NOT NULL, table_id INT NOT NULL, database_name STRING NOT NULL, - schema_name STRING, + schema_name STRING NOT NULL, table_name STRING NOT NULL, index_name STRING, lock_key BYTES NOT NULL, diff --git a/pkg/sql/delegate/show_range_for_row.go b/pkg/sql/delegate/show_range_for_row.go index f9d9a2b2e01f..4fe9567fb8cb 100644 --- a/pkg/sql/delegate/show_range_for_row.go +++ b/pkg/sql/delegate/show_range_for_row.go @@ -59,8 +59,16 @@ func (d *delegator) delegateShowRangeForRow(n *tree.ShowRangeForRow) (tree.State const query = ` SELECT - CASE WHEN r.start_key < x'%[5]s' THEN NULL ELSE crdb_internal.pretty_key(r.start_key, 2) END AS start_key, - CASE WHEN r.end_key >= x'%[6]s' THEN NULL ELSE crdb_internal.pretty_key(r.end_key, 2) END AS end_key, + CASE + WHEN r.start_key = crdb_internal.table_span(%[1]d)[1] THEN '…/' + WHEN r.start_key < crdb_internal.table_span(%[1]d)[1] THEN '' + ELSE '…'||crdb_internal.pretty_key(r.start_key, 2) + END AS start_key, + CASE + WHEN r.end_key = crdb_internal.table_span(%[1]d)[2] THEN '…/' + WHEN r.end_key < crdb_internal.table_span(%[1]d)[2] THEN '' + ELSE '…'||crdb_internal.pretty_key(r.end_key, 2) + END AS end_key, range_id, lease_holder, replica_localities[array_position(replicas, lease_holder)] as lease_holder_locality, diff --git a/pkg/sql/delegate/show_ranges.go b/pkg/sql/delegate/show_ranges.go index 1cd9ed990f9e..c1d6d09e37ec 100644 --- a/pkg/sql/delegate/show_ranges.go +++ b/pkg/sql/delegate/show_ranges.go @@ -11,7 +11,6 @@ package delegate import ( - "encoding/hex" "fmt" "github.com/cockroachdb/cockroach/pkg/sql/lexbase" @@ -43,6 +42,25 @@ func checkPrivilegesForShowRanges(d *delegator, table cat.Table) error { return nil } +// The following columns are rendered for all the syntax forms of +// SHOW RANGES, regardless of whether WITH DETAILS is specified. +// It must be able to compute with just crdb_internal.ranges_no_leases. +const commonShowRangesRenderColumnsEnd = ` + replicas, + replica_localities, + voting_replicas, + non_voting_replicas +` + +// The following columns are rendered for all the syntax forms of +// SHOW RANGES, only when WITH DETAILS is specified. +// This relies on crdb_internal.ranges (expensive) under the hood. +const commonShowRangesRenderColumnsEndDetails = ` + range_size / 1000000 as range_size_mb, + lease_holder, + replica_localities[array_position(replicas, lease_holder)] as lease_holder_locality, +` + // delegateShowRanges implements the SHOW RANGES statement: // // SHOW RANGES FROM TABLE t @@ -53,36 +71,155 @@ func checkPrivilegesForShowRanges(d *delegator, table cat.Table) error { // along with the list of replicas and the lease holder. func (d *delegator) delegateShowRanges(n *tree.ShowRanges) (tree.Statement, error) { sqltelemetry.IncrementShowCounter(sqltelemetry.Ranges) - if n.DatabaseName != "" { - const dbQuery = ` - SELECT - table_name, - CASE - WHEN crdb_internal.pretty_key(r.start_key, 2) = '' THEN NULL - ELSE crdb_internal.pretty_key(r.start_key, 2) - END AS start_key, - CASE - WHEN crdb_internal.pretty_key(r.end_key, 2) = '' THEN NULL - ELSE crdb_internal.pretty_key(r.end_key, 2) - END AS end_key, - range_id, - range_size / 1000000 as range_size_mb, - lease_holder, - replica_localities[array_position(replicas, lease_holder)] as lease_holder_locality, - replicas, - replica_localities, - voting_replicas, - non_voting_replicas - FROM %[1]s.crdb_internal.ranges AS r - WHERE database_name=%[2]s - ORDER BY table_name, r.start_key - ` - // Note: n.DatabaseName.String() != string(n.DatabaseName) - return parse(fmt.Sprintf(dbQuery, n.DatabaseName.String(), lexbase.EscapeSQLString(string(n.DatabaseName)))) - } - - // Remember the original syntax: Resolve below modifies the TableOrIndex struct in-place. - noIndexSpecified := n.TableOrIndex.Index == "" + + switch n.Source { + case tree.ShowRangesDatabase, tree.ShowRangesCurrentDatabase, tree.ShowRangesCluster: + return d.delegateShowRangesFromDatabase(n) + case tree.ShowRangesTable, tree.ShowRangesIndex: + return d.delegateShowRangesFromTableOrIndex(n) + default: + return nil, errors.AssertionFailedf("programming error: unsupported SHOW RANGES source %d", n.Source) + } +} + +func (d *delegator) delegateShowRangesFromDatabase(n *tree.ShowRanges) (tree.Statement, error) { + var dbName tree.Name + var joinMode string + switch n.Source { + case tree.ShowRangesCluster: + // This selects "".crdb_internal.table_spans, which gathers spans + // over all databases. + dbName = "" + // However, some ranges do not correspond to any table (tsd, etc). + // For those, we still want the range entry but we will need + // to leave the table/index details as NULL. + joinMode = "LEFT OUTER JOIN" + case tree.ShowRangesDatabase: + dbName = n.DatabaseName + joinMode = "JOIN" + case tree.ShowRangesCurrentDatabase: + // SHOW RANGES FROM CURRENT_CATALOG. + dbName = tree.Name(d.evalCtx.SessionData().Database) + joinMode = "JOIN" + } + + // Are we producing details? + detailColumns := "" + rangeSource := "crdb_internal.ranges_no_leases" + if n.Options.Details { + rangeSource = "crdb_internal.ranges" + detailColumns = ", range_size, lease_holder" + } + + // Filter the list of ranges to include only those ranges + // that contain spans from the target database. + filterTable := `table_spans` + extraColumn := `` + if n.Options.Mode == tree.ExpandIndexes { + filterTable = `index_spans` + extraColumn = `s.index_id,` + } + rangesQ := fmt.Sprintf(` + SELECT range_id, + r.start_key AS range_start_key, + r.end_key AS range_end_key, + s.descriptor_id AS table_id, %[3]s + s.start_key, + s.end_key, + replicas, replica_localities, voting_replicas, non_voting_replicas + %[5]s + FROM "".%[6]s r + %[4]s %[1]s.crdb_internal.%[2]s s + ON s.start_key < r.end_key + AND s.end_key > r.start_key`, + // Note: dbName.String() != string(dbName) + dbName.String(), filterTable, extraColumn, joinMode, detailColumns, rangeSource) + + // Expand table/index names if requested. + var expandedRangesQ string + switch n.Options.Mode { + case tree.UniqueRanges: + // One row per range: we can't compute table/index names. + expandedRangesQ = fmt.Sprintf(` +SELECT DISTINCT range_id, range_start_key, range_end_key, + replicas, replica_localities, voting_replicas, non_voting_replicas + %[1]s +FROM ranges`, detailColumns) + + case tree.ExpandTables: + // One row per range-table intersection. We can compute + // schema/table names. + expandedRangesQ = fmt.Sprintf(` + SELECT r.*, t.schema_name, t.name AS table_name + FROM ranges r + LEFT OUTER JOIN %[1]s.crdb_internal.tables t + ON r.table_id = t.table_id`, + // Note: dbName.String() != string(dbName) + dbName.String()) + + case tree.ExpandIndexes: + // One row per range-index intersection. We can compute + // schema/table and index names. + expandedRangesQ = fmt.Sprintf(` + SELECT r.*, t.schema_name, t.name AS table_name, ti.index_name + FROM ranges r + LEFT OUTER JOIN %[1]s.crdb_internal.table_indexes ti + ON r.table_id = ti.descriptor_id + AND r.index_id = ti.index_id + LEFT OUTER JOIN %[1]s.crdb_internal.tables t + ON r.table_id = t.table_id`, + // Note: dbName.String() != string(dbName) + dbName.String()) + } + + // Finally choose what to render. + extraColumns := `` + extraSort := `` + switch n.Options.Mode { + case tree.ExpandTables: + extraColumns = `schema_name, table_name, table_id, + crdb_internal.pretty_key(start_key, -1) AS table_start_key, + crdb_internal.pretty_key(end_key, -1) AS table_end_key,` + extraSort = `, table_start_key` + + case tree.ExpandIndexes: + extraColumns = `schema_name, table_name, table_id, index_name, index_id, + crdb_internal.pretty_key(start_key, -1) AS index_start_key, + crdb_internal.pretty_key(end_key, -1) AS index_end_key,` + extraSort = `, index_start_key` + } + + renderRangeDetails := commonShowRangesRenderColumnsEnd + if n.Options.Details { + renderRangeDetails = commonShowRangesRenderColumnsEndDetails + renderRangeDetails + } + + renderQ := fmt.Sprintf(` +SELECT + crdb_internal.pretty_key(range_start_key, -1) AS start_key, + crdb_internal.pretty_key(range_end_key, -1) AS end_key, + range_id, + %[1]s + %[2]s +FROM named_ranges r +ORDER BY r.range_start_key %[3]s + `, + extraColumns, + renderRangeDetails, + extraSort) + + fullQuery := `WITH ranges AS (` + rangesQ + `), named_ranges AS (` + expandedRangesQ + `) ` + renderQ + if n.Options.Explain { + fullQuery = fmt.Sprintf(`SELECT %s AS query`, lexbase.EscapeSQLString(fullQuery)) + } + return parse(fullQuery) +} + +func (d *delegator) delegateShowRangesFromTableOrIndex(n *tree.ShowRanges) (tree.Statement, error) { + fromTable := n.TableOrIndex.Index == "" // SHOW RANGES FROM TABLE, regardless of WITH clause. + fromIndex := !fromTable // SHOW RANGES FROM INDEX + fromTableUniqueRanges := fromTable && n.Options.Mode == tree.UniqueRanges // SHOW RANGES FROM TABLE + fromTableExpandIndexes := fromTable && n.Options.Mode == tree.ExpandIndexes // SHOW RANGES FROM TABLE WITH INDEXES idx, resName, err := cat.ResolveTableIndex( d.ctx, d.catalog, cat.Flags{AvoidDescriptorCaches: true}, &n.TableOrIndex, @@ -91,45 +228,151 @@ func (d *delegator) delegateShowRanges(n *tree.ShowRanges) (tree.Statement, erro return nil, err } - if err := checkPrivilegesForShowRanges(d, idx.Table()); err != nil { - return nil, err - } - if idx.Table().IsVirtualTable() { return nil, errors.New("SHOW RANGES may not be called on a virtual table") } - var startKey, endKey string - if noIndexSpecified { - // All indexes. - tableID := idx.Table().ID() - prefix := d.evalCtx.Codec.TablePrefix(uint32(tableID)) - startKey = hex.EncodeToString(prefix) - endKey = hex.EncodeToString(prefix.PrefixEnd()) - } else { - // Just one index. - span := idx.Span() - startKey = hex.EncodeToString(span.Key) - endKey = hex.EncodeToString(span.EndKey) - } - - return parse(fmt.Sprintf(` -SELECT - CASE WHEN r.start_key <= x'%[1]s' THEN NULL ELSE crdb_internal.pretty_key(r.start_key, 2) END AS start_key, - CASE WHEN r.end_key >= x'%[2]s' THEN NULL ELSE crdb_internal.pretty_key(r.end_key, 2) END AS end_key, - index_name, - range_id, - range_size / 1000000 as range_size_mb, - lease_holder, - replica_localities[array_position(replicas, lease_holder)] as lease_holder_locality, - replicas, - replica_localities, - voting_replicas, - non_voting_replicas -FROM %[3]s.crdb_internal.ranges AS r -WHERE (r.start_key < x'%[2]s') - AND (r.end_key > x'%[1]s') ORDER BY index_name, r.start_key + tabID := idx.Table().ID() + idxID := idx.ID() + + // Filter the list of ranges to include only those ranges + // that contain spans from within this table or index. + var filterTable, extraColumn, extraFilter string + switch { + case fromTableUniqueRanges: + filterTable = `table_spans` + case fromIndex: + filterTable = `index_spans` + extraColumn = `s.descriptor_id AS table_id,` + extraFilter = fmt.Sprintf(`AND s.index_id = %d`, idxID) + case fromTableExpandIndexes: + filterTable = `index_spans` + extraColumn = `s.descriptor_id AS table_id, s.index_id,` + } + rangesQ := fmt.Sprintf(` + SELECT range_id, + r.start_key AS range_start_key, + r.end_key AS range_end_key, + %[5]s + s.start_key, + s.end_key, + range_size, lease_holder, replicas, replica_localities, + voting_replicas, + non_voting_replicas + FROM "".crdb_internal.ranges r, + %[1]s.crdb_internal.%[2]s s + WHERE s.start_key < r.end_key + AND s.end_key > r.start_key + AND s.descriptor_id = %[3]d %[4]s `, - startKey, endKey, resName.CatalogName.String(), // note: CatalogName.String() != Catalog() - )) + // Note: dbName.String() != string(dbName) + resName.CatalogName.String(), + filterTable, + tabID, + extraFilter, + extraColumn) + + // Expand index names if requested. + var expandedRangesQ string + switch { + case fromTableUniqueRanges: + // One row per range: we can't compute table/index names. + expandedRangesQ = ` +SELECT DISTINCT range_id, range_start_key, range_end_key, start_key, end_key, + range_size, lease_holder, replicas, replica_localities, + voting_replicas, + non_voting_replicas +FROM ranges` + + case fromTableExpandIndexes: + // One row per range-index intersection. We can compute + // index names. + expandedRangesQ = fmt.Sprintf(` + SELECT r.*, ti.index_name + FROM ranges r + JOIN %[1]s.crdb_internal.table_indexes ti + ON r.table_id = ti.descriptor_id + AND r.index_id = ti.index_id`, + // Note: dbName.String() != string(dbName) + resName.CatalogName.String(), + ) + + case fromIndex: + // The index name is already known. No need to report it. + expandedRangesQ = `TABLE ranges` + + default: + return nil, errors.AssertionFailedf("programming error: missing case for %#v", n) + } + + // Finally choose what to render. + var renderColumnsStart, extraSort string + switch { + case fromTableUniqueRanges: + renderColumnsStart = ` +CASE + WHEN range_start_key = start_key THEN '…/' + WHEN range_start_key < start_key THEN '' + ELSE '…'||crdb_internal.pretty_key(range_start_key, 1) +END AS start_key, +CASE + WHEN range_end_key = end_key THEN '…/' + WHEN range_end_key > end_key THEN '' + ELSE '…'||crdb_internal.pretty_key(range_end_key, 1) +END AS end_key, +range_id,` + extraSort = `` + + case fromTableExpandIndexes: + renderColumnsStart = ` +CASE + WHEN range_start_key = start_key THEN '…/' + WHEN range_start_key = crdb_internal.table_span(table_id)[1] THEN '…/' + WHEN range_start_key < crdb_internal.table_span(table_id)[1] THEN '' + ELSE '…'||crdb_internal.pretty_key(range_start_key, 1) +END AS start_key, +CASE + WHEN range_end_key = end_key THEN '…/…/' + WHEN range_end_key = crdb_internal.table_span(table_id)[2] THEN '…/' + WHEN range_end_key > crdb_internal.table_span(table_id)[2] THEN '' + ELSE '…'||crdb_internal.pretty_key(range_end_key, 1) +END AS end_key, + range_id, index_name, index_id, + '…'||crdb_internal.pretty_key(start_key, 1) AS index_start_key, + '…'||crdb_internal.pretty_key(end_key, 1) AS index_end_key,` + extraSort = `, index_start_key` + + case fromIndex: + renderColumnsStart = ` +CASE + WHEN range_start_key = start_key THEN '…/' + WHEN range_start_key = crdb_internal.table_span(table_id)[1] THEN '…/TableMin' + WHEN range_start_key < start_key THEN '' + ELSE '…'||crdb_internal.pretty_key(range_start_key, 2) +END AS start_key, +CASE + WHEN range_end_key = end_key THEN '…/' + WHEN range_end_key = crdb_internal.table_span(table_id)[2] THEN '…/' + WHEN range_end_key > end_key THEN '' + ELSE '…'||crdb_internal.pretty_key(range_end_key, 2) +END AS end_key, + range_id,` + extraSort = `` + } + renderQ := fmt.Sprintf(` +SELECT + %[1]s + %[2]s +FROM named_ranges r +ORDER BY r.range_start_key %[3]s + `, + renderColumnsStart, + commonShowRangesRenderColumnsEnd, + extraSort) + + fullQuery := `WITH ranges AS (` + rangesQ + `), named_ranges AS (` + expandedRangesQ + `) ` + renderQ + if n.Options.Explain { + fullQuery = fmt.Sprintf(`SELECT %s AS query`, lexbase.EscapeSQLString(fullQuery)) + } + return parse(fullQuery) } diff --git a/pkg/sql/distsql_physical_planner_test.go b/pkg/sql/distsql_physical_planner_test.go index 8a30c596187a..45b0e465c978 100644 --- a/pkg/sql/distsql_physical_planner_test.go +++ b/pkg/sql/distsql_physical_planner_test.go @@ -418,14 +418,16 @@ func TestDistSQLDeadHosts(t *testing.T) { )) } r.CheckQueryResults(t, - "SELECT start_key, end_key, lease_holder, replicas FROM [SHOW RANGES FROM TABLE t]", + `SELECT IF(substring(start_key for 1)='…',start_key,NULL), + IF(substring(end_key for 1)='…',end_key,NULL), + lease_holder, replicas FROM [SHOW RANGES FROM TABLE t]`, [][]string{ - {"NULL", "/0", "1", "{1}"}, - {"/0", "/20", "1", "{1,2,3}"}, - {"/20", "/40", "2", "{2,3,4}"}, - {"/40", "/60", "3", "{1,3,4}"}, - {"/60", "/80", "4", "{1,2,4}"}, - {"/80", "NULL", "5", "{2,3,5}"}, + {"NULL", "…/1/0", "1", "{1}"}, + {"…/1/0", "…/1/20", "1", "{1,2,3}"}, + {"…/1/20", "…/1/40", "2", "{2,3,4}"}, + {"…/1/40", "…/1/60", "3", "{1,3,4}"}, + {"…/1/60", "…/1/80", "4", "{1,2,4}"}, + {"…/1/80", "NULL", "5", "{2,3,5}"}, }, ) diff --git a/pkg/sql/importer/import_into_test.go b/pkg/sql/importer/import_into_test.go index 6b52d9a5b382..80ad3b95465b 100644 --- a/pkg/sql/importer/import_into_test.go +++ b/pkg/sql/importer/import_into_test.go @@ -120,11 +120,11 @@ func TestProtectedTimestampsDuringImportInto(t *testing.T) { time.Sleep(3 * time.Second) // Wait for the data to definitely be expired and GC to run. gcTable := func(skipShouldQueue bool) (traceStr string) { - rows := runner.Query(t, "SELECT start_key"+ - " FROM crdb_internal.ranges_no_leases"+ - " WHERE table_name = $1"+ - " AND database_name = current_database()"+ - " ORDER BY start_key ASC", "foo") + rows := runner.Query(t, "SELECT r.start_key"+ + " FROM [SHOW RANGES FROM CURRENT_CATALOG WITH TABLES] sr,"+ + " crdb_internal.ranges_no_leases r"+ + " WHERE r.range_id = sr.range_id AND table_name = $1"+ + " ORDER BY r.start_key ASC", "foo") var traceBuf strings.Builder for rows.Next() { var startKey roachpb.Key diff --git a/pkg/sql/logictest/testdata/logic_test/cluster_locks b/pkg/sql/logictest/testdata/logic_test/cluster_locks index 4de80fb1c17d..2057f6f3cf33 100644 --- a/pkg/sql/logictest/testdata/logic_test/cluster_locks +++ b/pkg/sql/logictest/testdata/logic_test/cluster_locks @@ -20,10 +20,10 @@ key pretty split_enforced_until query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t] ---- -start_key end_key replicas lease_holder -NULL /"d" {1} 1 -/"d" /"r" {1} 1 -/"r" NULL {1} 1 +start_key end_key replicas lease_holder + …/1/"d" {1} 1 +…/1/"d" …/1/"r" {1} 1 +…/1/"r" {1} 1 # Also create an additional user with VIEWACTIVITYREDACTED, with only permissions on t statement ok @@ -66,13 +66,13 @@ let $txn2 SELECT txns.id FROM crdb_internal.cluster_transactions txns WHERE txns.session_id = '$testuser_session' let $r1 -SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key='/"d"' +SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key LIKE '%/"d"' let $r2 -SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key='/"r"' +SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key LIKE '%/"r"' let $r3 -SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key IS NULL +SELECT range_id FROM [SHOW RANGES FROM TABLE t] WHERE end_key LIKE '%Max%' user testuser diff --git a/pkg/sql/logictest/testdata/logic_test/crdb_internal b/pkg/sql/logictest/testdata/logic_test/crdb_internal index 3c5e02d3224c..f0828fe5186f 100644 --- a/pkg/sql/logictest/testdata/logic_test/crdb_internal +++ b/pkg/sql/logictest/testdata/logic_test/crdb_internal @@ -46,6 +46,7 @@ crdb_internal gossip_liveness table admin NULL NULL crdb_internal gossip_network table admin NULL NULL crdb_internal gossip_nodes table admin NULL NULL crdb_internal index_columns table admin NULL NULL +crdb_internal index_spans table admin NULL NULL crdb_internal index_usage_statistics table admin NULL NULL crdb_internal invalid_objects table admin NULL NULL crdb_internal jobs table admin NULL NULL @@ -84,6 +85,7 @@ crdb_internal super_regions table admin NULL NULL crdb_internal table_columns table admin NULL NULL crdb_internal table_indexes table admin NULL NULL crdb_internal table_row_statistics table admin NULL NULL +crdb_internal table_spans table admin NULL NULL crdb_internal tables table admin NULL NULL crdb_internal tenant_usage_details view admin NULL NULL crdb_internal transaction_contention_events table admin NULL NULL @@ -450,10 +452,10 @@ SELECT * FROM crdb_internal.ranges WHERE range_id < 0 ---- range_id start_key start_pretty end_key end_pretty table_id database_name schema_name table_name index_name replicas replica_localities voting_replicas non_voting_replicas learner_replicas split_enforced_until lease_holder range_size -query ITTTTITTTTTTTTTT colnames +query ITTTTTTTTTT colnames SELECT * FROM crdb_internal.ranges_no_leases WHERE range_id < 0 ---- -range_id start_key start_pretty end_key end_pretty table_id database_name schema_name table_name index_name replicas replica_localities voting_replicas non_voting_replicas learner_replicas split_enforced_until +range_id start_key start_pretty end_key end_pretty replicas replica_localities voting_replicas non_voting_replicas learner_replicas split_enforced_until statement ok CREATE SCHEMA schema; CREATE TABLE schema.bar (y INT PRIMARY KEY) @@ -597,8 +599,7 @@ start_pretty end_pretty split_enforced_until query TTT colnames SELECT start_pretty, end_pretty, split_enforced_until FROM crdb_internal.ranges_no_leases WHERE split_enforced_until IS NOT NULL AND table_name = 'foo' ---- -start_pretty end_pretty split_enforced_until -/Table/112/1/2 /Max 2262-04-11 23:47:16.854776 +0000 +0000 +start_pretty end_pretty split_enforced_until statement ok ALTER TABLE foo UNSPLIT AT VALUES(2) @@ -619,14 +620,12 @@ ALTER TABLE foo SPLIT AT VALUES(2) WITH EXPIRATION '2200-01-01 00:00:00.0' query TTT colnames SELECT start_pretty, end_pretty, split_enforced_until FROM crdb_internal.ranges WHERE split_enforced_until IS NOT NULL AND table_name = 'foo' ---- -start_pretty end_pretty split_enforced_until -/Table/112/1/2 /Max 2200-01-01 00:00:00 +0000 +0000 +start_pretty end_pretty split_enforced_until query TTT colnames SELECT start_pretty, end_pretty, split_enforced_until FROM crdb_internal.ranges_no_leases WHERE split_enforced_until IS NOT NULL AND table_name = 'foo' ---- -start_pretty end_pretty split_enforced_until -/Table/112/1/2 /Max 2200-01-01 00:00:00 +0000 +0000 +start_pretty end_pretty split_enforced_until statement ok ALTER TABLE foo SPLIT AT VALUES (1), (2), (3) @@ -637,12 +636,18 @@ ALTER TABLE foo UNSPLIT ALL query TT colnames SELECT start_pretty, end_pretty FROM crdb_internal.ranges WHERE split_enforced_until IS NOT NULL ---- -start_pretty end_pretty +start_pretty end_pretty +/Table/112/1/1 /Table/112/1/2 +/Table/112/1/2 /Table/112/1/3 +/Table/112/1/3 /Max query TT colnames SELECT start_pretty, end_pretty FROM crdb_internal.ranges_no_leases WHERE split_enforced_until IS NOT NULL ---- -start_pretty end_pretty +start_pretty end_pretty +/Table/112/1/1 /Table/112/1/2 +/Table/112/1/2 /Table/112/1/3 +/Table/112/1/3 /Max # Make sure that the cluster id isn't unset. query B @@ -886,7 +891,6 @@ SELECT crdb_internal.compact_engine_span(1, 1, start_key, end_key) FROM crdb_internal.ranges_no_leases WHERE table_name = 'foo' LIMIT 1 ---- crdb_internal.compact_engine_span -true # Failed compaction due to unknown node. query error could not dial node ID 153 diff --git a/pkg/sql/logictest/testdata/logic_test/dist_vectorize b/pkg/sql/logictest/testdata/logic_test/dist_vectorize index a064729ff81f..af451344dc04 100644 --- a/pkg/sql/logictest/testdata/logic_test/dist_vectorize +++ b/pkg/sql/logictest/testdata/logic_test/dist_vectorize @@ -29,23 +29,23 @@ ALTER TABLE kw EXPERIMENTAL_RELOCATE SELECT ARRAY[i], i FROM generate_series(1, query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv] ---- -NULL /1 {1} 1 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 + …/1/1 {1} 1 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify data placement. query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kw] ---- -NULL /1 {5} 5 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 + …/1/1 {5} 5 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify execution. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_agg b/pkg/sql/logictest/testdata/logic_test/distsql_agg index 2e049aae35c8..2a7d5852bc12 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_agg +++ b/pkg/sql/logictest/testdata/logic_test/distsql_agg @@ -24,17 +24,17 @@ INSERT INTO data SELECT a, b, c::FLOAT, d::DECIMAL FROM query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 query RI SELECT sum(a), sum_int(a) FROM data @@ -325,18 +325,18 @@ INSERT INTO two VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), ( query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE one] ---- -start_key end_key replicas lease_holder -NULL /0 {5} 5 -/0 /99 {1} 1 -/99 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/0 {5} 5 +…/1/0 …/1/99 {1} 1 +…/1/99 {5} 5 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE two] ---- -start_key end_key replicas lease_holder -NULL /0 {5} 5 -/0 /99 {2} 2 -/99 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/0 {5} 5 +…/1/0 …/1/99 {2} 2 +…/1/99 {5} 5 query I SELECT count(*) FROM one AS a, one AS b, two AS c @@ -703,9 +703,9 @@ INSERT INTO table74736 SELECT x * 10000, repeat('a', 200000) FROM generate_serie query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE table74736] ---- -start_key end_key replicas lease_holder -NULL /1000000 {1} 1 -/1000000 NULL {2} 2 +start_key end_key replicas lease_holder + …/1/1000000 {1} 1 +…/1/1000000 {2} 2 statement ok SET DISTSQL = OFF diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal b/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal index d61368ef83fa..a7d942956f23 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal +++ b/pkg/sql/logictest/testdata/logic_test/distsql_crdb_internal @@ -24,17 +24,17 @@ INSERT INTO data SELECT a, b, c::FLOAT, d::DECIMAL FROM query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 # As of #69273, crdb_internal.reset_sql_stats()'s behavior changes from in-memory diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on index 01ab3a68d5da..f9537b3e9b6d 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on +++ b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on @@ -64,23 +64,23 @@ ALTER TABLE abc EXPERIMENTAL_RELOCATE VALUES query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE xyz] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /4 {2} 2 -/4 /6 {3} 3 -/6 /7 {4} 4 -/7 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/4 {2} 2 +…/1/4 …/1/6 {3} 3 +…/1/6 …/1/7 {4} 4 +…/1/7 {5} 5 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE abc] ---- -start_key end_key replicas lease_holder -NULL /NULL/NULL/NULL {5} 5 -/NULL/NULL/NULL /"1"/"1"/"2" {1} 1 -/"1"/"1"/"2" /"1"/"2"/"2" {2} 2 -/"1"/"2"/"2" /"2"/"3"/"4" {3} 3 -/"2"/"3"/"4" /"3"/"4"/"5" {4} 4 -/"3"/"4"/"5" NULL {5} 5 +start_key end_key replicas lease_holder + …/1/NULL/NULL/NULL {5} 5 +…/1/NULL/NULL/NULL …/1/"1"/"1"/"2" {1} 1 +…/1/"1"/"1"/"2" …/1/"1"/"2"/"2" {2} 2 +…/1/"1"/"2"/"2" …/1/"2"/"3"/"4" {3} 3 +…/1/"2"/"3"/"4" …/1/"3"/"4"/"5" {4} 4 +…/1/"3"/"4"/"5" {5} 5 query III rowsort SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_numtables b/pkg/sql/logictest/testdata/logic_test/distsql_numtables index 5948e33cf9fd..bdd697bb955a 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_numtables +++ b/pkg/sql/logictest/testdata/logic_test/distsql_numtables @@ -29,18 +29,18 @@ INSERT INTO NumToStr SELECT i, to_english(i) FROM generate_series(1, 100*100) AS query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToSquare] ---- -start_key end_key replicas lease_holder -NULL NULL {1} 1 +start_key end_key replicas lease_holder + {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToStr] ---- -start_key end_key replicas lease_holder -NULL /2000 {1} 1 -/2000 /4000 {2} 2 -/4000 /6000 {3} 3 -/6000 /8000 {4} 4 -/8000 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2000 {1} 1 +…/1/2000 …/1/4000 {2} 2 +…/1/4000 …/1/6000 {3} 3 +…/1/6000 …/1/8000 {4} 4 +…/1/8000 {5} 5 # # -- Basic tests -- diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_subquery b/pkg/sql/logictest/testdata/logic_test/distsql_subquery index 95f059328846..6e5d339f951e 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_subquery +++ b/pkg/sql/logictest/testdata/logic_test/distsql_subquery @@ -21,9 +21,9 @@ ALTER TABLE ab EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1), (ARRAY[2], 2) query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE ab] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 NULL {2} 2 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 {2} 2 query T SELECT ARRAY(SELECT a FROM ab ORDER BY b) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_union b/pkg/sql/logictest/testdata/logic_test/distsql_union index a6960819a3ce..38bdca524fb6 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_union +++ b/pkg/sql/logictest/testdata/logic_test/distsql_union @@ -30,12 +30,12 @@ ALTER TABLE xyz EXPERIMENTAL_RELOCATE VALUES query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE xyz] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 subtest Union diff --git a/pkg/sql/logictest/testdata/logic_test/grant_table b/pkg/sql/logictest/testdata/logic_test/grant_table index 9cf2b07affeb..ab145f885ff1 100644 --- a/pkg/sql/logictest/testdata/logic_test/grant_table +++ b/pkg/sql/logictest/testdata/logic_test/grant_table @@ -59,6 +59,7 @@ test crdb_internal gossip_liveness public test crdb_internal gossip_network public SELECT false test crdb_internal gossip_nodes public SELECT false test crdb_internal index_columns public SELECT false +test crdb_internal index_spans public SELECT false test crdb_internal index_usage_statistics public SELECT false test crdb_internal invalid_objects public SELECT false test crdb_internal jobs public SELECT false @@ -97,6 +98,7 @@ test crdb_internal super_regions public test crdb_internal table_columns public SELECT false test crdb_internal table_indexes public SELECT false test crdb_internal table_row_statistics public SELECT false +test crdb_internal table_spans public SELECT false test crdb_internal tables public SELECT false test crdb_internal tenant_usage_details public SELECT false test crdb_internal transaction_contention_events public SELECT false diff --git a/pkg/sql/logictest/testdata/logic_test/hash_sharded_index b/pkg/sql/logictest/testdata/logic_test/hash_sharded_index index 8180ad6a35b4..5d56827b2290 100644 --- a/pkg/sql/logictest/testdata/logic_test/hash_sharded_index +++ b/pkg/sql/logictest/testdata/logic_test/hash_sharded_index @@ -810,28 +810,24 @@ CREATE TABLE t_hash_pre_split ( ); skipif config 3node-tenant-default-configs -query TITTT retry -SELECT t.name, r.table_id, r.index_name, r.start_pretty, r.end_pretty -FROM crdb_internal.tables t -JOIN crdb_internal.ranges r ON t.table_id = r.table_id -WHERE t.name = 't_hash_pre_split' -AND t.state = 'PUBLIC' -AND r.split_enforced_until IS NOT NULL; +query TITTT retry,rowsort +SELECT table_name, table_id, index_name, start_key, end_key + FROM [SHOW RANGES FROM DATABASE test WITH INDEXES] + WHERE table_name = 't_hash_pre_split' ---- +t_hash_pre_split 133 t_hash_pre_split_pkey /Table/128/3/7 /Max statement ok CREATE INDEX t_hash_pre_split_idx_b ON t_hash_pre_split (b) USING HASH WITH (bucket_count=8); skipif config 3node-tenant-default-configs -query TITTT colnames,retry -SELECT t.name, r.table_id, r.index_name, r.start_pretty, r.end_pretty -FROM crdb_internal.tables t -JOIN crdb_internal.ranges r ON t.table_id = r.table_id -WHERE t.name = 't_hash_pre_split' -AND t.state = 'PUBLIC' -AND r.split_enforced_until IS NOT NULL; +query TITTT colnames,retry,rowsort +SELECT table_name, table_id, index_name, start_key, end_key + FROM [SHOW RANGES FROM DATABASE test WITH INDEXES] + WHERE table_name = 't_hash_pre_split' ---- -name table_id index_name start_pretty end_pretty +table_name table_id index_name start_key end_key +t_hash_pre_split 133 t_hash_pre_split_pkey /Table/128/3/7 /Table/133/2 t_hash_pre_split 133 t_hash_pre_split_idx_b /Table/133/2 /Table/133/2/0 t_hash_pre_split 133 t_hash_pre_split_idx_b /Table/133/2/0 /Table/133/2/1 t_hash_pre_split 133 t_hash_pre_split_idx_b /Table/133/2/1 /Table/133/2/2 diff --git a/pkg/sql/logictest/testdata/logic_test/information_schema b/pkg/sql/logictest/testdata/logic_test/information_schema index 17c643d6135b..d23735700469 100644 --- a/pkg/sql/logictest/testdata/logic_test/information_schema +++ b/pkg/sql/logictest/testdata/logic_test/information_schema @@ -424,6 +424,7 @@ crdb_internal gossip_liveness crdb_internal gossip_network crdb_internal gossip_nodes crdb_internal index_columns +crdb_internal index_spans crdb_internal index_usage_statistics crdb_internal invalid_objects crdb_internal jobs @@ -462,6 +463,7 @@ crdb_internal super_regions crdb_internal table_columns crdb_internal table_indexes crdb_internal table_row_statistics +crdb_internal table_spans crdb_internal tables crdb_internal tenant_usage_details crdb_internal transaction_contention_events @@ -753,6 +755,7 @@ gossip_liveness gossip_network gossip_nodes index_columns +index_spans index_usage_statistics invalid_objects jobs @@ -791,6 +794,7 @@ super_regions table_columns table_indexes table_row_statistics +table_spans tables tenant_usage_details transaction_contention_events @@ -1077,6 +1081,7 @@ tablespaces tables_extensions tables tables +table_spans table_row_statistics table_privileges table_indexes @@ -1121,6 +1126,7 @@ system crdb_internal gossip_liveness SYSTEM system crdb_internal gossip_network SYSTEM VIEW NO 1 system crdb_internal gossip_nodes SYSTEM VIEW NO 1 system crdb_internal index_columns SYSTEM VIEW NO 1 +system crdb_internal index_spans SYSTEM VIEW NO 1 system crdb_internal index_usage_statistics SYSTEM VIEW NO 1 system crdb_internal invalid_objects SYSTEM VIEW NO 1 system crdb_internal jobs SYSTEM VIEW NO 1 @@ -1159,6 +1165,7 @@ system crdb_internal super_regions SYSTEM system crdb_internal table_columns SYSTEM VIEW NO 1 system crdb_internal table_indexes SYSTEM VIEW NO 1 system crdb_internal table_row_statistics SYSTEM VIEW NO 1 +system crdb_internal table_spans SYSTEM VIEW NO 1 system crdb_internal tables SYSTEM VIEW NO 1 system crdb_internal tenant_usage_details SYSTEM VIEW NO 1 system crdb_internal transaction_contention_events SYSTEM VIEW NO 1 @@ -2814,6 +2821,7 @@ NULL public system crdb_internal gossip_liveness NULL public system crdb_internal gossip_network SELECT NO YES NULL public system crdb_internal gossip_nodes SELECT NO YES NULL public system crdb_internal index_columns SELECT NO YES +NULL public system crdb_internal index_spans SELECT NO YES NULL public system crdb_internal index_usage_statistics SELECT NO YES NULL public system crdb_internal invalid_objects SELECT NO YES NULL public system crdb_internal jobs SELECT NO YES @@ -2852,6 +2860,7 @@ NULL public system crdb_internal super_regions NULL public system crdb_internal table_columns SELECT NO YES NULL public system crdb_internal table_indexes SELECT NO YES NULL public system crdb_internal table_row_statistics SELECT NO YES +NULL public system crdb_internal table_spans SELECT NO YES NULL public system crdb_internal tables SELECT NO YES NULL public system crdb_internal tenant_usage_details SELECT NO YES NULL public system crdb_internal transaction_contention_events SELECT NO YES @@ -3399,6 +3408,7 @@ NULL public system crdb_internal gossip_liveness NULL public system crdb_internal gossip_network SELECT NO YES NULL public system crdb_internal gossip_nodes SELECT NO YES NULL public system crdb_internal index_columns SELECT NO YES +NULL public system crdb_internal index_spans SELECT NO YES NULL public system crdb_internal index_usage_statistics SELECT NO YES NULL public system crdb_internal invalid_objects SELECT NO YES NULL public system crdb_internal jobs SELECT NO YES @@ -3437,6 +3447,7 @@ NULL public system crdb_internal super_regions NULL public system crdb_internal table_columns SELECT NO YES NULL public system crdb_internal table_indexes SELECT NO YES NULL public system crdb_internal table_row_statistics SELECT NO YES +NULL public system crdb_internal table_spans SELECT NO YES NULL public system crdb_internal tables SELECT NO YES NULL public system crdb_internal tenant_usage_details SELECT NO YES NULL public system crdb_internal transaction_contention_events SELECT NO YES diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist index 58df7c274998..847497da2dfb 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist @@ -38,10 +38,10 @@ ALTER TABLE ltable EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1), (ARRAY[2], 2), (A query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 {3} 3 query II SELECT lk, rk FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom1, rtable.geom) ORDER BY (lk, rk) diff --git a/pkg/sql/logictest/testdata/logic_test/kv_builtin_functions_local b/pkg/sql/logictest/testdata/logic_test/kv_builtin_functions_local index 4ccd97dce827..d25e1f5ef993 100644 --- a/pkg/sql/logictest/testdata/logic_test/kv_builtin_functions_local +++ b/pkg/sql/logictest/testdata/logic_test/kv_builtin_functions_local @@ -9,7 +9,7 @@ ALTER TABLE t SPLIT AT VALUES (0) # Get the range that contains this table. let $rangeid -SELECT range_id FROM crdb_internal.ranges WHERE table_name = 't' +SELECT range_id FROM [SHOW RANGES FROM TABLE t] LIMIT 1 query B SELECT crdb_internal.kv_enqueue_replica($rangeid, 'mvccGC', true); diff --git a/pkg/sql/logictest/testdata/logic_test/merge_join_dist b/pkg/sql/logictest/testdata/logic_test/merge_join_dist index 72cd1429bbc8..23a6f532b421 100644 --- a/pkg/sql/logictest/testdata/logic_test/merge_join_dist +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_dist @@ -29,18 +29,18 @@ ALTER TABLE r EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 2), (ARRAY[2], 3), (ARRAY[ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE l] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 {3} 3 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE r] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -/2 /3 {1} 1 -/3 NULL {2} 2 -NULL /2 {3} 3 +start_key end_key replicas lease_holder +…/1/2 …/1/3 {1} 1 +…/1/3 {2} 2 + …/1/2 {3} 3 query III SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2 diff --git a/pkg/sql/logictest/testdata/logic_test/pg_builtins b/pkg/sql/logictest/testdata/logic_test/pg_builtins index c8659d0a567d..0198fca97725 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_builtins +++ b/pkg/sql/logictest/testdata/logic_test/pg_builtins @@ -179,42 +179,42 @@ is_updatable b 120 2 28 is_updatable c 120 3 28 false is_updatable_view a 121 1 0 false is_updatable_view b 121 2 0 false -pg_class oid 4294967120 1 0 false -pg_class relname 4294967120 2 0 false -pg_class relnamespace 4294967120 3 0 false -pg_class reltype 4294967120 4 0 false -pg_class reloftype 4294967120 5 0 false -pg_class relowner 4294967120 6 0 false -pg_class relam 4294967120 7 0 false -pg_class relfilenode 4294967120 8 0 false -pg_class reltablespace 4294967120 9 0 false -pg_class relpages 4294967120 10 0 false -pg_class reltuples 4294967120 11 0 false -pg_class relallvisible 4294967120 12 0 false -pg_class reltoastrelid 4294967120 13 0 false -pg_class relhasindex 4294967120 14 0 false -pg_class relisshared 4294967120 15 0 false -pg_class relpersistence 4294967120 16 0 false -pg_class relistemp 4294967120 17 0 false -pg_class relkind 4294967120 18 0 false -pg_class relnatts 4294967120 19 0 false -pg_class relchecks 4294967120 20 0 false -pg_class relhasoids 4294967120 21 0 false -pg_class relhaspkey 4294967120 22 0 false -pg_class relhasrules 4294967120 23 0 false -pg_class relhastriggers 4294967120 24 0 false -pg_class relhassubclass 4294967120 25 0 false -pg_class relfrozenxid 4294967120 26 0 false -pg_class relacl 4294967120 27 0 false -pg_class reloptions 4294967120 28 0 false -pg_class relforcerowsecurity 4294967120 29 0 false -pg_class relispartition 4294967120 30 0 false -pg_class relispopulated 4294967120 31 0 false -pg_class relreplident 4294967120 32 0 false -pg_class relrewrite 4294967120 33 0 false -pg_class relrowsecurity 4294967120 34 0 false -pg_class relpartbound 4294967120 35 0 false -pg_class relminmxid 4294967120 36 0 false +pg_class oid 4294967118 1 0 false +pg_class relname 4294967118 2 0 false +pg_class relnamespace 4294967118 3 0 false +pg_class reltype 4294967118 4 0 false +pg_class reloftype 4294967118 5 0 false +pg_class relowner 4294967118 6 0 false +pg_class relam 4294967118 7 0 false +pg_class relfilenode 4294967118 8 0 false +pg_class reltablespace 4294967118 9 0 false +pg_class relpages 4294967118 10 0 false +pg_class reltuples 4294967118 11 0 false +pg_class relallvisible 4294967118 12 0 false +pg_class reltoastrelid 4294967118 13 0 false +pg_class relhasindex 4294967118 14 0 false +pg_class relisshared 4294967118 15 0 false +pg_class relpersistence 4294967118 16 0 false +pg_class relistemp 4294967118 17 0 false +pg_class relkind 4294967118 18 0 false +pg_class relnatts 4294967118 19 0 false +pg_class relchecks 4294967118 20 0 false +pg_class relhasoids 4294967118 21 0 false +pg_class relhaspkey 4294967118 22 0 false +pg_class relhasrules 4294967118 23 0 false +pg_class relhastriggers 4294967118 24 0 false +pg_class relhassubclass 4294967118 25 0 false +pg_class relfrozenxid 4294967118 26 0 false +pg_class relacl 4294967118 27 0 false +pg_class reloptions 4294967118 28 0 false +pg_class relforcerowsecurity 4294967118 29 0 false +pg_class relispartition 4294967118 30 0 false +pg_class relispopulated 4294967118 31 0 false +pg_class relreplident 4294967118 32 0 false +pg_class relrewrite 4294967118 33 0 false +pg_class relrowsecurity 4294967118 34 0 false +pg_class relpartbound 4294967118 35 0 false +pg_class relminmxid 4294967118 36 0 false # Check that the oid does not exist. If this test fail, change the oid here and in diff --git a/pkg/sql/logictest/testdata/logic_test/pg_catalog b/pkg/sql/logictest/testdata/logic_test/pg_catalog index 832d272cf09e..007505ccf678 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_catalog +++ b/pkg/sql/logictest/testdata/logic_test/pg_catalog @@ -428,9 +428,9 @@ SELECT * FROM pg_catalog.pg_namespace ---- oid nspname nspowner nspacl 4294967295 crdb_internal NULL NULL -4294967219 information_schema NULL NULL -4294967132 pg_catalog NULL NULL -4294967002 pg_extension NULL NULL +4294967217 information_schema NULL NULL +4294967130 pg_catalog NULL NULL +4294967000 pg_extension NULL NULL 105 public 2310524507 NULL # Verify that we can still see the schemas even if we don't have any privilege @@ -447,9 +447,9 @@ SELECT * FROM pg_catalog.pg_namespace ---- oid nspname nspowner nspacl 4294967295 crdb_internal NULL NULL -4294967219 information_schema NULL NULL -4294967132 pg_catalog NULL NULL -4294967002 pg_extension NULL NULL +4294967217 information_schema NULL NULL +4294967130 pg_catalog NULL NULL +4294967000 pg_extension NULL NULL 105 public 2310524507 NULL user root @@ -1298,7 +1298,7 @@ SELECT * FROM pg_collation WHERE collname='en-US' ---- oid collname collnamespace collowner collencoding collcollate collctype collprovider collversion collisdeterministic -3903121477 en-US 4294967132 NULL 6 NULL NULL NULL NULL NULL +3903121477 en-US 4294967130 NULL 6 NULL NULL NULL NULL NULL user testuser @@ -1497,16 +1497,16 @@ FROM pg_catalog.pg_depend ORDER BY objid, refobjid, refobjsubid ---- classid objid objsubid refclassid refobjid refobjsubid deptype -4294967117 111 0 4294967120 110 14 a -4294967117 112 0 4294967120 110 15 a -4294967074 842401391 0 4294967120 110 1 n -4294967074 842401391 0 4294967120 110 2 n -4294967074 842401391 0 4294967120 110 3 n -4294967074 842401391 0 4294967120 110 4 n -4294967117 1179276562 0 4294967120 3687884464 0 n -4294967117 3935750373 0 4294967120 3687884465 0 n -4294967117 4072017905 0 4294967120 0 0 n -4294967117 4170826110 0 4294967120 0 0 n +4294967115 111 0 4294967118 110 14 a +4294967115 112 0 4294967118 110 15 a +4294967072 842401391 0 4294967118 110 1 n +4294967072 842401391 0 4294967118 110 2 n +4294967072 842401391 0 4294967118 110 3 n +4294967072 842401391 0 4294967118 110 4 n +4294967115 1179276562 0 4294967118 3687884464 0 n +4294967115 3935750373 0 4294967118 3687884465 0 n +4294967115 4072017905 0 4294967118 0 0 n +4294967115 4170826110 0 4294967118 0 0 n # Some entries in pg_depend are dependency links from the pg_constraint system # table to the pg_class system table. Other entries are links to pg_class when it is @@ -1519,8 +1519,8 @@ JOIN pg_class cla ON classid=cla.oid JOIN pg_class refcla ON refclassid=refcla.oid ---- classid refclassid tablename reftablename -4294967074 4294967120 pg_rewrite pg_class -4294967117 4294967120 pg_constraint pg_class +4294967072 4294967118 pg_rewrite pg_class +4294967115 4294967118 pg_constraint pg_class # Some entries in pg_depend are foreign key constraints that reference an index # in pg_class. Other entries are table-view dependencies @@ -1619,88 +1619,88 @@ WHERE oid < 4194967002 -- exclude implicit types for virtual tables ORDER BY oid ---- oid typname typnamespace typowner typlen typbyval typtype -16 bool 4294967132 NULL 1 true b -17 bytea 4294967132 NULL -1 false b -18 char 4294967132 NULL 1 true b -19 name 4294967132 NULL -1 false b -20 int8 4294967132 NULL 8 true b -21 int2 4294967132 NULL 2 true b -22 int2vector 4294967132 NULL -1 false b -23 int4 4294967132 NULL 4 true b -24 regproc 4294967132 NULL 8 true b -25 text 4294967132 NULL -1 false b -26 oid 4294967132 NULL 8 true b -30 oidvector 4294967132 NULL -1 false b -700 float4 4294967132 NULL 4 true b -701 float8 4294967132 NULL 8 true b -705 unknown 4294967132 NULL 0 true b -869 inet 4294967132 NULL 24 true b -1000 _bool 4294967132 NULL -1 false b -1001 _bytea 4294967132 NULL -1 false b -1002 _char 4294967132 NULL -1 false b -1003 _name 4294967132 NULL -1 false b -1005 _int2 4294967132 NULL -1 false b -1006 _int2vector 4294967132 NULL -1 false b -1007 _int4 4294967132 NULL -1 false b -1008 _regproc 4294967132 NULL -1 false b -1009 _text 4294967132 NULL -1 false b -1013 _oidvector 4294967132 NULL -1 false b -1014 _bpchar 4294967132 NULL -1 false b -1015 _varchar 4294967132 NULL -1 false b -1016 _int8 4294967132 NULL -1 false b -1021 _float4 4294967132 NULL -1 false b -1022 _float8 4294967132 NULL -1 false b -1028 _oid 4294967132 NULL -1 false b -1041 _inet 4294967132 NULL -1 false b -1042 bpchar 4294967132 NULL -1 false b -1043 varchar 4294967132 NULL -1 false b -1082 date 4294967132 NULL 16 true b -1083 time 4294967132 NULL 8 true b -1114 timestamp 4294967132 NULL 24 true b -1115 _timestamp 4294967132 NULL -1 false b -1182 _date 4294967132 NULL -1 false b -1183 _time 4294967132 NULL -1 false b -1184 timestamptz 4294967132 NULL 24 true b -1185 _timestamptz 4294967132 NULL -1 false b -1186 interval 4294967132 NULL 24 true b -1187 _interval 4294967132 NULL -1 false b -1231 _numeric 4294967132 NULL -1 false b -1266 timetz 4294967132 NULL 16 true b -1270 _timetz 4294967132 NULL -1 false b -1560 bit 4294967132 NULL -1 false b -1561 _bit 4294967132 NULL -1 false b -1562 varbit 4294967132 NULL -1 false b -1563 _varbit 4294967132 NULL -1 false b -1700 numeric 4294967132 NULL -1 false b -2202 regprocedure 4294967132 NULL 8 true b -2205 regclass 4294967132 NULL 8 true b -2206 regtype 4294967132 NULL 8 true b -2207 _regprocedure 4294967132 NULL -1 false b -2210 _regclass 4294967132 NULL -1 false b -2211 _regtype 4294967132 NULL -1 false b -2249 record 4294967132 NULL 0 true p -2277 anyarray 4294967132 NULL -1 false p -2278 void 4294967132 NULL 0 true p -2283 anyelement 4294967132 NULL -1 false p -2287 _record 4294967132 NULL -1 false b -2950 uuid 4294967132 NULL 16 true b -2951 _uuid 4294967132 NULL -1 false b -3614 tsvector 4294967132 NULL -1 false b -3615 tsquery 4294967132 NULL -1 false b -3643 _tsvector 4294967132 NULL -1 false b -3645 _tsquery 4294967132 NULL -1 false b -3802 jsonb 4294967132 NULL -1 false b -3807 _jsonb 4294967132 NULL -1 false b -4089 regnamespace 4294967132 NULL 8 true b -4090 _regnamespace 4294967132 NULL -1 false b -4096 regrole 4294967132 NULL 8 true b -4097 _regrole 4294967132 NULL -1 false b -90000 geometry 4294967132 NULL -1 false b -90001 _geometry 4294967132 NULL -1 false b -90002 geography 4294967132 NULL -1 false b -90003 _geography 4294967132 NULL -1 false b -90004 box2d 4294967132 NULL 32 true b -90005 _box2d 4294967132 NULL -1 false b +16 bool 4294967130 NULL 1 true b +17 bytea 4294967130 NULL -1 false b +18 char 4294967130 NULL 1 true b +19 name 4294967130 NULL -1 false b +20 int8 4294967130 NULL 8 true b +21 int2 4294967130 NULL 2 true b +22 int2vector 4294967130 NULL -1 false b +23 int4 4294967130 NULL 4 true b +24 regproc 4294967130 NULL 8 true b +25 text 4294967130 NULL -1 false b +26 oid 4294967130 NULL 8 true b +30 oidvector 4294967130 NULL -1 false b +700 float4 4294967130 NULL 4 true b +701 float8 4294967130 NULL 8 true b +705 unknown 4294967130 NULL 0 true b +869 inet 4294967130 NULL 24 true b +1000 _bool 4294967130 NULL -1 false b +1001 _bytea 4294967130 NULL -1 false b +1002 _char 4294967130 NULL -1 false b +1003 _name 4294967130 NULL -1 false b +1005 _int2 4294967130 NULL -1 false b +1006 _int2vector 4294967130 NULL -1 false b +1007 _int4 4294967130 NULL -1 false b +1008 _regproc 4294967130 NULL -1 false b +1009 _text 4294967130 NULL -1 false b +1013 _oidvector 4294967130 NULL -1 false b +1014 _bpchar 4294967130 NULL -1 false b +1015 _varchar 4294967130 NULL -1 false b +1016 _int8 4294967130 NULL -1 false b +1021 _float4 4294967130 NULL -1 false b +1022 _float8 4294967130 NULL -1 false b +1028 _oid 4294967130 NULL -1 false b +1041 _inet 4294967130 NULL -1 false b +1042 bpchar 4294967130 NULL -1 false b +1043 varchar 4294967130 NULL -1 false b +1082 date 4294967130 NULL 16 true b +1083 time 4294967130 NULL 8 true b +1114 timestamp 4294967130 NULL 24 true b +1115 _timestamp 4294967130 NULL -1 false b +1182 _date 4294967130 NULL -1 false b +1183 _time 4294967130 NULL -1 false b +1184 timestamptz 4294967130 NULL 24 true b +1185 _timestamptz 4294967130 NULL -1 false b +1186 interval 4294967130 NULL 24 true b +1187 _interval 4294967130 NULL -1 false b +1231 _numeric 4294967130 NULL -1 false b +1266 timetz 4294967130 NULL 16 true b +1270 _timetz 4294967130 NULL -1 false b +1560 bit 4294967130 NULL -1 false b +1561 _bit 4294967130 NULL -1 false b +1562 varbit 4294967130 NULL -1 false b +1563 _varbit 4294967130 NULL -1 false b +1700 numeric 4294967130 NULL -1 false b +2202 regprocedure 4294967130 NULL 8 true b +2205 regclass 4294967130 NULL 8 true b +2206 regtype 4294967130 NULL 8 true b +2207 _regprocedure 4294967130 NULL -1 false b +2210 _regclass 4294967130 NULL -1 false b +2211 _regtype 4294967130 NULL -1 false b +2249 record 4294967130 NULL 0 true p +2277 anyarray 4294967130 NULL -1 false p +2278 void 4294967130 NULL 0 true p +2283 anyelement 4294967130 NULL -1 false p +2287 _record 4294967130 NULL -1 false b +2950 uuid 4294967130 NULL 16 true b +2951 _uuid 4294967130 NULL -1 false b +3614 tsvector 4294967130 NULL -1 false b +3615 tsquery 4294967130 NULL -1 false b +3643 _tsvector 4294967130 NULL -1 false b +3645 _tsquery 4294967130 NULL -1 false b +3802 jsonb 4294967130 NULL -1 false b +3807 _jsonb 4294967130 NULL -1 false b +4089 regnamespace 4294967130 NULL 8 true b +4090 _regnamespace 4294967130 NULL -1 false b +4096 regrole 4294967130 NULL 8 true b +4097 _regrole 4294967130 NULL -1 false b +90000 geometry 4294967130 NULL -1 false b +90001 _geometry 4294967130 NULL -1 false b +90002 geography 4294967130 NULL -1 false b +90003 _geography 4294967130 NULL -1 false b +90004 box2d 4294967130 NULL 32 true b +90005 _box2d 4294967130 NULL -1 false b 100110 t1 109 1546506610 -1 false c 100111 t1_m_seq 109 1546506610 -1 false c 100112 t1_n_seq 109 1546506610 -1 false c @@ -2176,7 +2176,7 @@ FROM pg_catalog.pg_type WHERE oid = 1000 ---- oid typname typnamespace typowner typlen typbyval typtype -1000 _bool 4294967132 NULL -1 false b +1000 _bool 4294967130 NULL -1 false b query OTOOIBT colnames SELECT oid, typname, typnamespace, typowner, typlen, typbyval, typtype @@ -2234,7 +2234,7 @@ FROM pg_catalog.pg_type WHERE oid = $vtableSourceId ---- oid typname typnamespace typowner typlen typbyval typtype -4294967082 pg_proc 4294967132 2310524507 -1 false c +4294967080 pg_proc 4294967130 2310524507 -1 false c ## pg_catalog.pg_proc @@ -2244,14 +2244,14 @@ FROM pg_catalog.pg_proc WHERE proname='substring' ---- proname pronamespace proowner prolang procost prorows provariadic -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 -substring 4294967132 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 +substring 4294967130 NULL 0 NULL NULL 0 query TTBBBB colnames SELECT proname, protransform, proisagg, proiswindow, prosecdef, proleakproof @@ -2405,290 +2405,292 @@ SELECT objoid, classoid, objsubid, regexp_replace(description, e'\n.*', '') AS d FROM pg_catalog.pg_description ---- objoid classoid objsubid description -4294966999 4294967120 0 Shows all defined Spatial Reference Identifiers (SRIDs). Matches PostGIS' spatial_ref_sys table. -4294967000 4294967120 0 Shows all defined geometry columns. Matches PostGIS' geometry_columns functionality. -4294967001 4294967120 0 Shows all defined geography columns. Matches PostGIS' geography_columns functionality. -4294967003 4294967120 0 view definitions (incomplete - see also information_schema.views) -4294967004 4294967120 0 database users -4294967005 4294967120 0 pg_user_mappings was created for compatibility and is currently unimplemented -4294967006 4294967120 0 local to remote user mapping (empty - feature does not exist) -4294967007 4294967120 0 scalar types (incomplete) -4294967008 4294967120 0 pg_ts_template was created for compatibility and is currently unimplemented -4294967009 4294967120 0 pg_ts_parser was created for compatibility and is currently unimplemented -4294967010 4294967120 0 pg_ts_dict was created for compatibility and is currently unimplemented -4294967011 4294967120 0 pg_ts_config was created for compatibility and is currently unimplemented -4294967012 4294967120 0 pg_ts_config_map was created for compatibility and is currently unimplemented -4294967013 4294967120 0 triggers (empty - feature does not exist) -4294967014 4294967120 0 pg_transform was created for compatibility and is currently unimplemented -4294967015 4294967120 0 pg_timezone_names was created for compatibility and is currently unimplemented -4294967016 4294967120 0 pg_timezone_abbrevs was created for compatibility and is currently unimplemented -4294967017 4294967120 0 available tablespaces (incomplete; concept inapplicable to CockroachDB) -4294967018 4294967120 0 tables summary (see also information_schema.tables, pg_catalog.pg_class) -4294967019 4294967120 0 pg_subscription was created for compatibility and is currently unimplemented -4294967020 4294967120 0 pg_subscription_rel was created for compatibility and is currently unimplemented -4294967021 4294967120 0 pg_stats was created for compatibility and is currently unimplemented -4294967022 4294967120 0 pg_stats_ext was created for compatibility and is currently unimplemented -4294967023 4294967120 0 pg_statistic was created for compatibility and is currently unimplemented -4294967024 4294967120 0 pg_statistic_ext has the statistics objects created with CREATE STATISTICS -4294967025 4294967120 0 pg_statistic_ext_data was created for compatibility and is currently unimplemented -4294967026 4294967120 0 pg_statio_user_tables was created for compatibility and is currently unimplemented -4294967027 4294967120 0 pg_statio_user_sequences was created for compatibility and is currently unimplemented -4294967028 4294967120 0 pg_statio_user_indexes was created for compatibility and is currently unimplemented -4294967029 4294967120 0 pg_statio_sys_tables was created for compatibility and is currently unimplemented -4294967030 4294967120 0 pg_statio_sys_sequences was created for compatibility and is currently unimplemented -4294967031 4294967120 0 pg_statio_sys_indexes was created for compatibility and is currently unimplemented -4294967032 4294967120 0 pg_statio_all_tables was created for compatibility and is currently unimplemented -4294967033 4294967120 0 pg_statio_all_sequences was created for compatibility and is currently unimplemented -4294967034 4294967120 0 pg_statio_all_indexes was created for compatibility and is currently unimplemented -4294967035 4294967120 0 pg_stat_xact_user_tables was created for compatibility and is currently unimplemented -4294967036 4294967120 0 pg_stat_xact_user_functions was created for compatibility and is currently unimplemented -4294967037 4294967120 0 pg_stat_xact_sys_tables was created for compatibility and is currently unimplemented -4294967038 4294967120 0 pg_stat_xact_all_tables was created for compatibility and is currently unimplemented -4294967039 4294967120 0 pg_stat_wal_receiver was created for compatibility and is currently unimplemented -4294967040 4294967120 0 pg_stat_user_tables was created for compatibility and is currently unimplemented -4294967041 4294967120 0 pg_stat_user_indexes was created for compatibility and is currently unimplemented -4294967042 4294967120 0 pg_stat_user_functions was created for compatibility and is currently unimplemented -4294967043 4294967120 0 pg_stat_sys_tables was created for compatibility and is currently unimplemented -4294967044 4294967120 0 pg_stat_sys_indexes was created for compatibility and is currently unimplemented -4294967045 4294967120 0 pg_stat_subscription was created for compatibility and is currently unimplemented -4294967046 4294967120 0 pg_stat_ssl was created for compatibility and is currently unimplemented -4294967047 4294967120 0 pg_stat_slru was created for compatibility and is currently unimplemented -4294967048 4294967120 0 pg_stat_replication was created for compatibility and is currently unimplemented -4294967049 4294967120 0 pg_stat_progress_vacuum was created for compatibility and is currently unimplemented -4294967050 4294967120 0 pg_stat_progress_create_index was created for compatibility and is currently unimplemented -4294967051 4294967120 0 pg_stat_progress_cluster was created for compatibility and is currently unimplemented -4294967052 4294967120 0 pg_stat_progress_basebackup was created for compatibility and is currently unimplemented -4294967053 4294967120 0 pg_stat_progress_analyze was created for compatibility and is currently unimplemented -4294967054 4294967120 0 pg_stat_gssapi was created for compatibility and is currently unimplemented -4294967055 4294967120 0 pg_stat_database was created for compatibility and is currently unimplemented -4294967056 4294967120 0 pg_stat_database_conflicts was created for compatibility and is currently unimplemented -4294967057 4294967120 0 pg_stat_bgwriter was created for compatibility and is currently unimplemented -4294967058 4294967120 0 pg_stat_archiver was created for compatibility and is currently unimplemented -4294967059 4294967120 0 pg_stat_all_tables was created for compatibility and is currently unimplemented -4294967060 4294967120 0 pg_stat_all_indexes was created for compatibility and is currently unimplemented -4294967061 4294967120 0 backend access statistics (empty - monitoring works differently in CockroachDB) -4294967062 4294967120 0 pg_shmem_allocations was created for compatibility and is currently unimplemented -4294967063 4294967120 0 Shared Dependencies (Roles depending on objects). -4294967064 4294967120 0 shared security labels (empty - feature not supported) -4294967065 4294967120 0 shared object comments -4294967066 4294967120 0 pg_shadow lists properties for roles that are marked as rolcanlogin in pg_authid -4294967067 4294967120 0 session variables (incomplete) -4294967068 4294967120 0 pg_sequences is very similar as pg_sequence. -4294967069 4294967120 0 sequences (see also information_schema.sequences) -4294967070 4294967120 0 security labels (empty - feature does not exist) -4294967071 4294967120 0 security labels (empty) -4294967072 4294967120 0 pg_rules was created for compatibility and is currently unimplemented -4294967073 4294967120 0 database roles -4294967074 4294967120 0 rewrite rules (only for referencing on pg_depend for table-view dependencies) -4294967075 4294967120 0 pg_replication_slots was created for compatibility and is currently unimplemented -4294967076 4294967120 0 pg_replication_origin was created for compatibility and is currently unimplemented -4294967077 4294967120 0 pg_replication_origin_status was created for compatibility and is currently unimplemented -4294967078 4294967120 0 range types (empty - feature does not exist) -4294967079 4294967120 0 pg_publication_tables was created for compatibility and is currently unimplemented -4294967080 4294967120 0 pg_publication was created for compatibility and is currently unimplemented -4294967081 4294967120 0 pg_publication_rel was created for compatibility and is currently unimplemented -4294967082 4294967120 0 built-in functions (incomplete) -4294967083 4294967120 0 prepared transactions (empty - feature does not exist) -4294967084 4294967120 0 prepared statements -4294967085 4294967120 0 pg_policy was created for compatibility and is currently unimplemented -4294967086 4294967120 0 pg_policies was created for compatibility and is currently unimplemented -4294967087 4294967120 0 pg_partitioned_table was created for compatibility and is currently unimplemented -4294967088 4294967120 0 pg_opfamily was created for compatibility and is currently unimplemented -4294967089 4294967120 0 operators (incomplete) -4294967090 4294967120 0 opclass (empty - Operator classes not supported yet) -4294967091 4294967120 0 available namespaces -4294967092 4294967120 0 available materialized views (empty - feature does not exist) -4294967093 4294967120 0 locks held by active processes (empty - feature does not exist) -4294967094 4294967120 0 pg_largeobject was created for compatibility and is currently unimplemented -4294967095 4294967120 0 pg_largeobject_metadata was created for compatibility and is currently unimplemented -4294967096 4294967120 0 available languages (empty - feature does not exist) -4294967097 4294967120 0 pg_init_privs was created for compatibility and is currently unimplemented -4294967098 4294967120 0 table inheritance hierarchy (empty - feature does not exist) -4294967099 4294967120 0 index creation statements -4294967100 4294967120 0 indexes (incomplete) -4294967101 4294967120 0 pg_hba_file_rules was created for compatibility and is currently unimplemented -4294967102 4294967120 0 pg_group was created for compatibility and is currently unimplemented -4294967103 4294967120 0 foreign tables (empty - feature does not exist) -4294967104 4294967120 0 foreign servers (empty - feature does not exist) -4294967105 4294967120 0 foreign data wrappers (empty - feature does not exist) -4294967106 4294967120 0 pg_file_settings was created for compatibility and is currently unimplemented -4294967107 4294967120 0 installed extensions (empty - feature does not exist) -4294967108 4294967120 0 event triggers (empty - feature does not exist) -4294967109 4294967120 0 enum types and labels (empty - feature does not exist) -4294967110 4294967120 0 object comments -4294967111 4294967120 0 dependency relationships (incomplete) -4294967112 4294967120 0 default ACLs; these are the privileges that will be assigned to newly created objects -4294967113 4294967120 0 contains the default values that have been configured for session variables -4294967114 4294967120 0 available databases (incomplete) -4294967115 4294967120 0 contains currently active SQL cursors created with DECLARE -4294967116 4294967120 0 encoding conversions (empty - unimplemented) -4294967117 4294967120 0 table constraints (incomplete - see also information_schema.table_constraints) -4294967118 4294967120 0 pg_config was created for compatibility and is currently unimplemented -4294967119 4294967120 0 available collations (incomplete) -4294967120 4294967120 0 tables and relation-like objects (incomplete - see also information_schema.tables/sequences/views) -4294967121 4294967120 0 casts (empty - needs filling out) -4294967122 4294967120 0 available extensions -4294967123 4294967120 0 pg_available_extension_versions was created for compatibility and is currently unimplemented -4294967124 4294967120 0 role membership -4294967125 4294967120 0 authorization identifiers - differs from postgres as we do not display passwords, -4294967126 4294967120 0 table columns (incomplete - see also information_schema.columns) -4294967127 4294967120 0 column default values -4294967128 4294967120 0 pg_amproc was created for compatibility and is currently unimplemented -4294967129 4294967120 0 pg_amop was created for compatibility and is currently unimplemented -4294967130 4294967120 0 index access methods (incomplete) -4294967131 4294967120 0 aggregated built-in functions (incomplete) -4294967133 4294967120 0 views (incomplete) -4294967134 4294967120 0 view_table_usage was created for compatibility and is currently unimplemented -4294967135 4294967120 0 view_routine_usage was created for compatibility and is currently unimplemented -4294967136 4294967120 0 view_column_usage was created for compatibility and is currently unimplemented -4294967137 4294967120 0 grantable privileges (incomplete) -4294967138 4294967120 0 user_mappings was created for compatibility and is currently unimplemented -4294967139 4294967120 0 user_mapping_options was created for compatibility and is currently unimplemented -4294967140 4294967120 0 user_defined_types was created for compatibility and is currently unimplemented -4294967141 4294967120 0 user_attributes was created for compatibility and is currently unimplemented -4294967142 4294967120 0 usage_privileges was created for compatibility and is currently unimplemented -4294967143 4294967120 0 udt_privileges was created for compatibility and is currently unimplemented -4294967144 4294967120 0 type privileges (incomplete; may contain excess users or roles) -4294967145 4294967120 0 triggers was created for compatibility and is currently unimplemented -4294967146 4294967120 0 triggered_update_columns was created for compatibility and is currently unimplemented -4294967147 4294967120 0 transforms was created for compatibility and is currently unimplemented -4294967148 4294967120 0 tablespaces was created for compatibility and is currently unimplemented -4294967149 4294967120 0 tablespaces_extensions was created for compatibility and is currently unimplemented -4294967150 4294967120 0 tables and views -4294967151 4294967120 0 tables_extensions was created for compatibility and is currently unimplemented -4294967152 4294967120 0 privileges granted on table or views (incomplete; may contain excess users or roles) -4294967153 4294967120 0 table_constraints_extensions was created for compatibility and is currently unimplemented -4294967154 4294967120 0 table constraints -4294967155 4294967120 0 index metadata and statistics (incomplete) -4294967156 4294967120 0 st_units_of_measure was created for compatibility and is currently unimplemented -4294967157 4294967120 0 st_spatial_reference_systems was created for compatibility and is currently unimplemented -4294967158 4294967120 0 st_geometry_columns was created for compatibility and is currently unimplemented -4294967159 4294967120 0 exposes the session variables. -4294967160 4294967120 0 sequences -4294967161 4294967120 0 schema privileges (incomplete; may contain excess users or roles) -4294967162 4294967120 0 database schemas (may contain schemata without permission) -4294967163 4294967120 0 schemata_extensions was created for compatibility and is currently unimplemented -4294967164 4294967120 0 sql_sizing was created for compatibility and is currently unimplemented -4294967165 4294967120 0 sql_parts was created for compatibility and is currently unimplemented -4294967166 4294967120 0 sql_implementation_info was created for compatibility and is currently unimplemented -4294967167 4294967120 0 sql_features was created for compatibility and is currently unimplemented -4294967168 4294967120 0 built-in functions (empty - introspection not yet supported) -4294967169 4294967120 0 routine_privileges was created for compatibility and is currently unimplemented -4294967170 4294967120 0 role_usage_grants was created for compatibility and is currently unimplemented -4294967171 4294967120 0 role_udt_grants was created for compatibility and is currently unimplemented -4294967172 4294967120 0 privileges granted on table or views (incomplete; see also information_schema.table_privileges; may contain excess users or roles) -4294967173 4294967120 0 privileges granted on functions (incomplete; only contains privileges of user-defined functions) -4294967174 4294967120 0 role_column_grants was created for compatibility and is currently unimplemented -4294967175 4294967120 0 resource_groups was created for compatibility and is currently unimplemented -4294967176 4294967120 0 foreign key constraints -4294967177 4294967120 0 profiling was created for compatibility and is currently unimplemented -4294967178 4294967120 0 processlist was created for compatibility and is currently unimplemented -4294967179 4294967120 0 plugins was created for compatibility and is currently unimplemented -4294967180 4294967120 0 partitions was created for compatibility and is currently unimplemented -4294967181 4294967120 0 built-in function parameters (empty - introspection not yet supported) -4294967182 4294967120 0 optimizer_trace was created for compatibility and is currently unimplemented -4294967183 4294967120 0 keywords was created for compatibility and is currently unimplemented -4294967184 4294967120 0 column usage by indexes and key constraints -4294967185 4294967120 0 information_schema_catalog_name was created for compatibility and is currently unimplemented -4294967186 4294967120 0 foreign_tables was created for compatibility and is currently unimplemented -4294967187 4294967120 0 foreign_table_options was created for compatibility and is currently unimplemented -4294967188 4294967120 0 foreign_servers was created for compatibility and is currently unimplemented -4294967189 4294967120 0 foreign_server_options was created for compatibility and is currently unimplemented -4294967190 4294967120 0 foreign_data_wrappers was created for compatibility and is currently unimplemented -4294967191 4294967120 0 foreign_data_wrapper_options was created for compatibility and is currently unimplemented -4294967192 4294967120 0 files was created for compatibility and is currently unimplemented -4294967193 4294967120 0 events was created for compatibility and is currently unimplemented -4294967194 4294967120 0 engines was created for compatibility and is currently unimplemented -4294967195 4294967120 0 roles for the current user -4294967196 4294967120 0 element_types was created for compatibility and is currently unimplemented -4294967197 4294967120 0 domains was created for compatibility and is currently unimplemented -4294967198 4294967120 0 domain_udt_usage was created for compatibility and is currently unimplemented -4294967199 4294967120 0 domain_constraints was created for compatibility and is currently unimplemented -4294967200 4294967120 0 data_type_privileges was created for compatibility and is currently unimplemented -4294967201 4294967120 0 constraint_table_usage was created for compatibility and is currently unimplemented -4294967202 4294967120 0 columns usage by constraints -4294967203 4294967120 0 table and view columns (incomplete) -4294967204 4294967120 0 columns_extensions was created for compatibility and is currently unimplemented -4294967205 4294967120 0 columns with user defined types -4294967206 4294967120 0 column_statistics was created for compatibility and is currently unimplemented -4294967207 4294967120 0 column privilege grants (incomplete) -4294967208 4294967120 0 column_options was created for compatibility and is currently unimplemented -4294967209 4294967120 0 column_domain_usage was created for compatibility and is currently unimplemented -4294967210 4294967120 0 column_column_usage was created for compatibility and is currently unimplemented -4294967211 4294967120 0 shows the collations available in the current database -4294967212 4294967120 0 identifies which character set the available collations are -4294967213 4294967120 0 check constraints -4294967214 4294967120 0 check_constraint_routine_usage was created for compatibility and is currently unimplemented -4294967215 4294967120 0 character sets available in the current database -4294967216 4294967120 0 attributes was created for compatibility and is currently unimplemented -4294967217 4294967120 0 roles available to the current user -4294967218 4294967120 0 roles for which the current user has admin option -4294967220 4294967120 0 list super regions of databases visible to the current user -4294967221 4294967120 0 which entries of pg_catalog are implemented in this version of CockroachDB -4294967223 4294967120 0 node-level table listing all currently running range feeds -4294967224 4294967120 0 virtual table with default privileges -4294967225 4294967120 0 available regions for the cluster -4294967226 4294967120 0 traces for in-flight spans across all nodes in the cluster (cluster RPC; expensive!) -4294967227 4294967120 0 virtual table with table descriptors that still have data -4294967228 4294967120 0 virtual table with cross db references -4294967229 4294967120 0 virtual table with database privileges -4294967230 4294967120 0 virtual table to validate descriptors -4294967231 4294967120 0 decoded zone configurations from system.zones (KV scan) -4294967233 4294967120 0 finer-grained transaction statistics. The contents of this table are flushed to the system.transaction_statistics table at the interval set by the cluster setting sql.stats.flush.interval (by default, 10m). -4294967234 4294967120 0 stats for all tables accessible by current user in current database as of 10s ago -4294967235 4294967120 0 table descriptors accessible by current user, including non-public and virtual (KV scan; expensive!) -4294967236 4294967120 0 indexes accessible by current user in current database (KV scan) -4294967237 4294967120 0 details for all columns accessible by current user in current database (KV scan) -4294967239 4294967120 0 session variables (RAM) -4294967240 4294967120 0 session trace accumulated so far (RAM) -4294967241 4294967120 0 ongoing schema changes, across all descriptors accessible by current user (KV scan; expensive!) -4294967242 4294967120 0 server parameters, useful to construct connection URLs (RAM, local node only) -4294967244 4294967120 0 range metadata without leaseholder details (KV join; expensive!) -4294967245 4294967120 0 defined partitions for all tables/indexes accessible by the current user in the current database (KV scan) -4294967246 4294967120 0 per-application transaction statistics (in-memory, not durable; local node only). This table is wiped periodically (by default, at least every two hours) -4294967247 4294967120 0 statement statistics. The contents of this table are flushed to the system.statement_statistics table at the interval set by the cluster setting sql.stats.flush.interval (by default, 10m). -4294967248 4294967120 0 current values for metrics (RAM; local node only) -4294967249 4294967120 0 running sessions visible by current user (RAM; local node only) -4294967250 4294967120 0 running user transactions visible by the current user (RAM; local node only) -4294967251 4294967120 0 running queries visible by current user (RAM; local node only) -4294967253 4294967120 0 DistSQL remote flows information (RAM; local node only) -4294967254 4294967120 0 contention information (RAM; local node only) -4294967255 4294967120 0 acquired table leases (RAM; local node only) -4294967256 4294967120 0 store details and status (cluster RPC; expensive!) -4294967257 4294967120 0 node details across the entire cluster (cluster RPC; expensive!) -4294967258 4294967120 0 decoded job metadata from system.jobs (KV scan) -4294967259 4294967120 0 in-flight spans (RAM; local node only) -4294967260 4294967120 0 cluster-wide index usage statistics (in-memory, not durable).Querying this table is an expensive operation since it creates acluster-wide RPC fanout. -4294967261 4294967120 0 index columns for all indexes accessible by current user in current database (KV scan) -4294967262 4294967120 0 cluster-wide transaction contention events. Querying this table is an -4294967263 4294967120 0 locally known edges in the gossip network (RAM; local node only) -4294967264 4294967120 0 locally known gossiped node liveness (RAM; local node only) -4294967265 4294967120 0 locally known gossiped health alerts (RAM; local node only) -4294967266 4294967120 0 locally known gossiped node details (RAM; local node only) -4294967267 4294967120 0 node liveness status, as seen by kv -4294967268 4294967120 0 forward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan) -4294967269 4294967120 0 telemetry counters (RAM; local node only) -4294967270 4294967120 0 databases accessible by the current user (KV scan) -4294967271 4294967120 0 CREATE statements for all user defined types accessible by the current user in current database (KV scan) -4294967272 4294967120 0 CREATE and ALTER statements for all tables accessible by current user in current database (KV scan) -4294967273 4294967120 0 CREATE statements for all user defined schemas accessible by the current user in current database (KV scan) -4294967274 4294967120 0 CREATE statements for all user-defined functions -4294967275 4294967120 0 cluster-wide transaction statistics that have not yet been flushed to system tables. Querying this table is a somewhat expensive operation since it creates a cluster-wide RPC-fanout. -4294967276 4294967120 0 cluster-wide statement statistics that have not yet been flushed to system tables. Querying this table is a somewhat expensive operation since it creates a cluster-wide RPC-fanout. -4294967277 4294967120 0 cluster settings (RAM) -4294967278 4294967120 0 running sessions visible to current user (cluster RPC; expensive!) -4294967279 4294967120 0 running user transactions visible by the current user (cluster RPC; expensive!) -4294967280 4294967120 0 running queries visible by current user (cluster RPC; expensive!) -4294967281 4294967120 0 cluster-wide locks held in lock tables. Querying this table is an -4294967283 4294967120 0 DistSQL remote flows information (cluster RPC; expensive!) -4294967284 4294967120 0 contention information (cluster RPC; expensive!) -4294967288 4294967120 0 like system.zones but overlaid with in-txn in-memory changes -4294967289 4294967120 0 like system.namespace but overlaid with in-txn in-memory changes -4294967290 4294967120 0 like system.descriptor but overlaid with in-txn in-memory changes and including virtual objects -4294967291 4294967120 0 like system.comments but overlaid with in-txn in-memory changes and including virtual objects -4294967292 4294967120 0 built-in functions (RAM/static) -4294967293 4294967120 0 detailed identification strings (RAM, local node only) -4294967294 4294967120 0 backward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan) +4294966997 4294967118 0 Shows all defined Spatial Reference Identifiers (SRIDs). Matches PostGIS' spatial_ref_sys table. +4294966998 4294967118 0 Shows all defined geometry columns. Matches PostGIS' geometry_columns functionality. +4294966999 4294967118 0 Shows all defined geography columns. Matches PostGIS' geography_columns functionality. +4294967001 4294967118 0 view definitions (incomplete - see also information_schema.views) +4294967002 4294967118 0 database users +4294967003 4294967118 0 pg_user_mappings was created for compatibility and is currently unimplemented +4294967004 4294967118 0 local to remote user mapping (empty - feature does not exist) +4294967005 4294967118 0 scalar types (incomplete) +4294967006 4294967118 0 pg_ts_template was created for compatibility and is currently unimplemented +4294967007 4294967118 0 pg_ts_parser was created for compatibility and is currently unimplemented +4294967008 4294967118 0 pg_ts_dict was created for compatibility and is currently unimplemented +4294967009 4294967118 0 pg_ts_config was created for compatibility and is currently unimplemented +4294967010 4294967118 0 pg_ts_config_map was created for compatibility and is currently unimplemented +4294967011 4294967118 0 triggers (empty - feature does not exist) +4294967012 4294967118 0 pg_transform was created for compatibility and is currently unimplemented +4294967013 4294967118 0 pg_timezone_names was created for compatibility and is currently unimplemented +4294967014 4294967118 0 pg_timezone_abbrevs was created for compatibility and is currently unimplemented +4294967015 4294967118 0 available tablespaces (incomplete; concept inapplicable to CockroachDB) +4294967016 4294967118 0 tables summary (see also information_schema.tables, pg_catalog.pg_class) +4294967017 4294967118 0 pg_subscription was created for compatibility and is currently unimplemented +4294967018 4294967118 0 pg_subscription_rel was created for compatibility and is currently unimplemented +4294967019 4294967118 0 pg_stats was created for compatibility and is currently unimplemented +4294967020 4294967118 0 pg_stats_ext was created for compatibility and is currently unimplemented +4294967021 4294967118 0 pg_statistic was created for compatibility and is currently unimplemented +4294967022 4294967118 0 pg_statistic_ext has the statistics objects created with CREATE STATISTICS +4294967023 4294967118 0 pg_statistic_ext_data was created for compatibility and is currently unimplemented +4294967024 4294967118 0 pg_statio_user_tables was created for compatibility and is currently unimplemented +4294967025 4294967118 0 pg_statio_user_sequences was created for compatibility and is currently unimplemented +4294967026 4294967118 0 pg_statio_user_indexes was created for compatibility and is currently unimplemented +4294967027 4294967118 0 pg_statio_sys_tables was created for compatibility and is currently unimplemented +4294967028 4294967118 0 pg_statio_sys_sequences was created for compatibility and is currently unimplemented +4294967029 4294967118 0 pg_statio_sys_indexes was created for compatibility and is currently unimplemented +4294967030 4294967118 0 pg_statio_all_tables was created for compatibility and is currently unimplemented +4294967031 4294967118 0 pg_statio_all_sequences was created for compatibility and is currently unimplemented +4294967032 4294967118 0 pg_statio_all_indexes was created for compatibility and is currently unimplemented +4294967033 4294967118 0 pg_stat_xact_user_tables was created for compatibility and is currently unimplemented +4294967034 4294967118 0 pg_stat_xact_user_functions was created for compatibility and is currently unimplemented +4294967035 4294967118 0 pg_stat_xact_sys_tables was created for compatibility and is currently unimplemented +4294967036 4294967118 0 pg_stat_xact_all_tables was created for compatibility and is currently unimplemented +4294967037 4294967118 0 pg_stat_wal_receiver was created for compatibility and is currently unimplemented +4294967038 4294967118 0 pg_stat_user_tables was created for compatibility and is currently unimplemented +4294967039 4294967118 0 pg_stat_user_indexes was created for compatibility and is currently unimplemented +4294967040 4294967118 0 pg_stat_user_functions was created for compatibility and is currently unimplemented +4294967041 4294967118 0 pg_stat_sys_tables was created for compatibility and is currently unimplemented +4294967042 4294967118 0 pg_stat_sys_indexes was created for compatibility and is currently unimplemented +4294967043 4294967118 0 pg_stat_subscription was created for compatibility and is currently unimplemented +4294967044 4294967118 0 pg_stat_ssl was created for compatibility and is currently unimplemented +4294967045 4294967118 0 pg_stat_slru was created for compatibility and is currently unimplemented +4294967046 4294967118 0 pg_stat_replication was created for compatibility and is currently unimplemented +4294967047 4294967118 0 pg_stat_progress_vacuum was created for compatibility and is currently unimplemented +4294967048 4294967118 0 pg_stat_progress_create_index was created for compatibility and is currently unimplemented +4294967049 4294967118 0 pg_stat_progress_cluster was created for compatibility and is currently unimplemented +4294967050 4294967118 0 pg_stat_progress_basebackup was created for compatibility and is currently unimplemented +4294967051 4294967118 0 pg_stat_progress_analyze was created for compatibility and is currently unimplemented +4294967052 4294967118 0 pg_stat_gssapi was created for compatibility and is currently unimplemented +4294967053 4294967118 0 pg_stat_database was created for compatibility and is currently unimplemented +4294967054 4294967118 0 pg_stat_database_conflicts was created for compatibility and is currently unimplemented +4294967055 4294967118 0 pg_stat_bgwriter was created for compatibility and is currently unimplemented +4294967056 4294967118 0 pg_stat_archiver was created for compatibility and is currently unimplemented +4294967057 4294967118 0 pg_stat_all_tables was created for compatibility and is currently unimplemented +4294967058 4294967118 0 pg_stat_all_indexes was created for compatibility and is currently unimplemented +4294967059 4294967118 0 backend access statistics (empty - monitoring works differently in CockroachDB) +4294967060 4294967118 0 pg_shmem_allocations was created for compatibility and is currently unimplemented +4294967061 4294967118 0 Shared Dependencies (Roles depending on objects). +4294967062 4294967118 0 shared security labels (empty - feature not supported) +4294967063 4294967118 0 shared object comments +4294967064 4294967118 0 pg_shadow lists properties for roles that are marked as rolcanlogin in pg_authid +4294967065 4294967118 0 session variables (incomplete) +4294967066 4294967118 0 pg_sequences is very similar as pg_sequence. +4294967067 4294967118 0 sequences (see also information_schema.sequences) +4294967068 4294967118 0 security labels (empty - feature does not exist) +4294967069 4294967118 0 security labels (empty) +4294967070 4294967118 0 pg_rules was created for compatibility and is currently unimplemented +4294967071 4294967118 0 database roles +4294967072 4294967118 0 rewrite rules (only for referencing on pg_depend for table-view dependencies) +4294967073 4294967118 0 pg_replication_slots was created for compatibility and is currently unimplemented +4294967074 4294967118 0 pg_replication_origin was created for compatibility and is currently unimplemented +4294967075 4294967118 0 pg_replication_origin_status was created for compatibility and is currently unimplemented +4294967076 4294967118 0 range types (empty - feature does not exist) +4294967077 4294967118 0 pg_publication_tables was created for compatibility and is currently unimplemented +4294967078 4294967118 0 pg_publication was created for compatibility and is currently unimplemented +4294967079 4294967118 0 pg_publication_rel was created for compatibility and is currently unimplemented +4294967080 4294967118 0 built-in functions (incomplete) +4294967081 4294967118 0 prepared transactions (empty - feature does not exist) +4294967082 4294967118 0 prepared statements +4294967083 4294967118 0 pg_policy was created for compatibility and is currently unimplemented +4294967084 4294967118 0 pg_policies was created for compatibility and is currently unimplemented +4294967085 4294967118 0 pg_partitioned_table was created for compatibility and is currently unimplemented +4294967086 4294967118 0 pg_opfamily was created for compatibility and is currently unimplemented +4294967087 4294967118 0 operators (incomplete) +4294967088 4294967118 0 opclass (empty - Operator classes not supported yet) +4294967089 4294967118 0 available namespaces +4294967090 4294967118 0 available materialized views (empty - feature does not exist) +4294967091 4294967118 0 locks held by active processes (empty - feature does not exist) +4294967092 4294967118 0 pg_largeobject was created for compatibility and is currently unimplemented +4294967093 4294967118 0 pg_largeobject_metadata was created for compatibility and is currently unimplemented +4294967094 4294967118 0 available languages (empty - feature does not exist) +4294967095 4294967118 0 pg_init_privs was created for compatibility and is currently unimplemented +4294967096 4294967118 0 table inheritance hierarchy (empty - feature does not exist) +4294967097 4294967118 0 index creation statements +4294967098 4294967118 0 indexes (incomplete) +4294967099 4294967118 0 pg_hba_file_rules was created for compatibility and is currently unimplemented +4294967100 4294967118 0 pg_group was created for compatibility and is currently unimplemented +4294967101 4294967118 0 foreign tables (empty - feature does not exist) +4294967102 4294967118 0 foreign servers (empty - feature does not exist) +4294967103 4294967118 0 foreign data wrappers (empty - feature does not exist) +4294967104 4294967118 0 pg_file_settings was created for compatibility and is currently unimplemented +4294967105 4294967118 0 installed extensions (empty - feature does not exist) +4294967106 4294967118 0 event triggers (empty - feature does not exist) +4294967107 4294967118 0 enum types and labels (empty - feature does not exist) +4294967108 4294967118 0 object comments +4294967109 4294967118 0 dependency relationships (incomplete) +4294967110 4294967118 0 default ACLs; these are the privileges that will be assigned to newly created objects +4294967111 4294967118 0 contains the default values that have been configured for session variables +4294967112 4294967118 0 available databases (incomplete) +4294967113 4294967118 0 contains currently active SQL cursors created with DECLARE +4294967114 4294967118 0 encoding conversions (empty - unimplemented) +4294967115 4294967118 0 table constraints (incomplete - see also information_schema.table_constraints) +4294967116 4294967118 0 pg_config was created for compatibility and is currently unimplemented +4294967117 4294967118 0 available collations (incomplete) +4294967118 4294967118 0 tables and relation-like objects (incomplete - see also information_schema.tables/sequences/views) +4294967119 4294967118 0 casts (empty - needs filling out) +4294967120 4294967118 0 available extensions +4294967121 4294967118 0 pg_available_extension_versions was created for compatibility and is currently unimplemented +4294967122 4294967118 0 role membership +4294967123 4294967118 0 authorization identifiers - differs from postgres as we do not display passwords, +4294967124 4294967118 0 table columns (incomplete - see also information_schema.columns) +4294967125 4294967118 0 column default values +4294967126 4294967118 0 pg_amproc was created for compatibility and is currently unimplemented +4294967127 4294967118 0 pg_amop was created for compatibility and is currently unimplemented +4294967128 4294967118 0 index access methods (incomplete) +4294967129 4294967118 0 aggregated built-in functions (incomplete) +4294967131 4294967118 0 views (incomplete) +4294967132 4294967118 0 view_table_usage was created for compatibility and is currently unimplemented +4294967133 4294967118 0 view_routine_usage was created for compatibility and is currently unimplemented +4294967134 4294967118 0 view_column_usage was created for compatibility and is currently unimplemented +4294967135 4294967118 0 grantable privileges (incomplete) +4294967136 4294967118 0 user_mappings was created for compatibility and is currently unimplemented +4294967137 4294967118 0 user_mapping_options was created for compatibility and is currently unimplemented +4294967138 4294967118 0 user_defined_types was created for compatibility and is currently unimplemented +4294967139 4294967118 0 user_attributes was created for compatibility and is currently unimplemented +4294967140 4294967118 0 usage_privileges was created for compatibility and is currently unimplemented +4294967141 4294967118 0 udt_privileges was created for compatibility and is currently unimplemented +4294967142 4294967118 0 type privileges (incomplete; may contain excess users or roles) +4294967143 4294967118 0 triggers was created for compatibility and is currently unimplemented +4294967144 4294967118 0 triggered_update_columns was created for compatibility and is currently unimplemented +4294967145 4294967118 0 transforms was created for compatibility and is currently unimplemented +4294967146 4294967118 0 tablespaces was created for compatibility and is currently unimplemented +4294967147 4294967118 0 tablespaces_extensions was created for compatibility and is currently unimplemented +4294967148 4294967118 0 tables and views +4294967149 4294967118 0 tables_extensions was created for compatibility and is currently unimplemented +4294967150 4294967118 0 privileges granted on table or views (incomplete; may contain excess users or roles) +4294967151 4294967118 0 table_constraints_extensions was created for compatibility and is currently unimplemented +4294967152 4294967118 0 table constraints +4294967153 4294967118 0 index metadata and statistics (incomplete) +4294967154 4294967118 0 st_units_of_measure was created for compatibility and is currently unimplemented +4294967155 4294967118 0 st_spatial_reference_systems was created for compatibility and is currently unimplemented +4294967156 4294967118 0 st_geometry_columns was created for compatibility and is currently unimplemented +4294967157 4294967118 0 exposes the session variables. +4294967158 4294967118 0 sequences +4294967159 4294967118 0 schema privileges (incomplete; may contain excess users or roles) +4294967160 4294967118 0 database schemas (may contain schemata without permission) +4294967161 4294967118 0 schemata_extensions was created for compatibility and is currently unimplemented +4294967162 4294967118 0 sql_sizing was created for compatibility and is currently unimplemented +4294967163 4294967118 0 sql_parts was created for compatibility and is currently unimplemented +4294967164 4294967118 0 sql_implementation_info was created for compatibility and is currently unimplemented +4294967165 4294967118 0 sql_features was created for compatibility and is currently unimplemented +4294967166 4294967118 0 built-in functions (empty - introspection not yet supported) +4294967167 4294967118 0 routine_privileges was created for compatibility and is currently unimplemented +4294967168 4294967118 0 role_usage_grants was created for compatibility and is currently unimplemented +4294967169 4294967118 0 role_udt_grants was created for compatibility and is currently unimplemented +4294967170 4294967118 0 privileges granted on table or views (incomplete; see also information_schema.table_privileges; may contain excess users or roles) +4294967171 4294967118 0 privileges granted on functions (incomplete; only contains privileges of user-defined functions) +4294967172 4294967118 0 role_column_grants was created for compatibility and is currently unimplemented +4294967173 4294967118 0 resource_groups was created for compatibility and is currently unimplemented +4294967174 4294967118 0 foreign key constraints +4294967175 4294967118 0 profiling was created for compatibility and is currently unimplemented +4294967176 4294967118 0 processlist was created for compatibility and is currently unimplemented +4294967177 4294967118 0 plugins was created for compatibility and is currently unimplemented +4294967178 4294967118 0 partitions was created for compatibility and is currently unimplemented +4294967179 4294967118 0 built-in function parameters (empty - introspection not yet supported) +4294967180 4294967118 0 optimizer_trace was created for compatibility and is currently unimplemented +4294967181 4294967118 0 keywords was created for compatibility and is currently unimplemented +4294967182 4294967118 0 column usage by indexes and key constraints +4294967183 4294967118 0 information_schema_catalog_name was created for compatibility and is currently unimplemented +4294967184 4294967118 0 foreign_tables was created for compatibility and is currently unimplemented +4294967185 4294967118 0 foreign_table_options was created for compatibility and is currently unimplemented +4294967186 4294967118 0 foreign_servers was created for compatibility and is currently unimplemented +4294967187 4294967118 0 foreign_server_options was created for compatibility and is currently unimplemented +4294967188 4294967118 0 foreign_data_wrappers was created for compatibility and is currently unimplemented +4294967189 4294967118 0 foreign_data_wrapper_options was created for compatibility and is currently unimplemented +4294967190 4294967118 0 files was created for compatibility and is currently unimplemented +4294967191 4294967118 0 events was created for compatibility and is currently unimplemented +4294967192 4294967118 0 engines was created for compatibility and is currently unimplemented +4294967193 4294967118 0 roles for the current user +4294967194 4294967118 0 element_types was created for compatibility and is currently unimplemented +4294967195 4294967118 0 domains was created for compatibility and is currently unimplemented +4294967196 4294967118 0 domain_udt_usage was created for compatibility and is currently unimplemented +4294967197 4294967118 0 domain_constraints was created for compatibility and is currently unimplemented +4294967198 4294967118 0 data_type_privileges was created for compatibility and is currently unimplemented +4294967199 4294967118 0 constraint_table_usage was created for compatibility and is currently unimplemented +4294967200 4294967118 0 columns usage by constraints +4294967201 4294967118 0 table and view columns (incomplete) +4294967202 4294967118 0 columns_extensions was created for compatibility and is currently unimplemented +4294967203 4294967118 0 columns with user defined types +4294967204 4294967118 0 column_statistics was created for compatibility and is currently unimplemented +4294967205 4294967118 0 column privilege grants (incomplete) +4294967206 4294967118 0 column_options was created for compatibility and is currently unimplemented +4294967207 4294967118 0 column_domain_usage was created for compatibility and is currently unimplemented +4294967208 4294967118 0 column_column_usage was created for compatibility and is currently unimplemented +4294967209 4294967118 0 shows the collations available in the current database +4294967210 4294967118 0 identifies which character set the available collations are +4294967211 4294967118 0 check constraints +4294967212 4294967118 0 check_constraint_routine_usage was created for compatibility and is currently unimplemented +4294967213 4294967118 0 character sets available in the current database +4294967214 4294967118 0 attributes was created for compatibility and is currently unimplemented +4294967215 4294967118 0 roles available to the current user +4294967216 4294967118 0 roles for which the current user has admin option +4294967218 4294967118 0 list super regions of databases visible to the current user +4294967219 4294967118 0 which entries of pg_catalog are implemented in this version of CockroachDB +4294967221 4294967118 0 node-level table listing all currently running range feeds +4294967222 4294967118 0 virtual table with default privileges +4294967223 4294967118 0 available regions for the cluster +4294967224 4294967118 0 traces for in-flight spans across all nodes in the cluster (cluster RPC; expensive!) +4294967225 4294967118 0 virtual table with table descriptors that still have data +4294967226 4294967118 0 virtual table with cross db references +4294967227 4294967118 0 virtual table with database privileges +4294967228 4294967118 0 virtual table to validate descriptors +4294967229 4294967118 0 decoded zone configurations from system.zones (KV scan) +4294967231 4294967118 0 finer-grained transaction statistics. The contents of this table are flushed to the system.transaction_statistics table at the interval set by the cluster setting sql.stats.flush.interval (by default, 10m). +4294967232 4294967118 0 stats for all tables accessible by current user in current database as of 10s ago +4294967233 4294967118 0 table descriptors accessible by current user, including non-public and virtual (KV scan; expensive!) +4294967234 4294967118 0 key spans per SQL object +4294967235 4294967118 0 indexes accessible by current user in current database (KV scan) +4294967236 4294967118 0 details for all columns accessible by current user in current database (KV scan) +4294967238 4294967118 0 session variables (RAM) +4294967239 4294967118 0 session trace accumulated so far (RAM) +4294967240 4294967118 0 ongoing schema changes, across all descriptors accessible by current user (KV scan; expensive!) +4294967241 4294967118 0 server parameters, useful to construct connection URLs (RAM, local node only) +4294967243 4294967118 0 range metadata without leaseholder details (KV join; expensive!) +4294967244 4294967118 0 defined partitions for all tables/indexes accessible by the current user in the current database (KV scan) +4294967245 4294967118 0 per-application transaction statistics (in-memory, not durable; local node only). This table is wiped periodically (by default, at least every two hours) +4294967246 4294967118 0 statement statistics. The contents of this table are flushed to the system.statement_statistics table at the interval set by the cluster setting sql.stats.flush.interval (by default, 10m). +4294967247 4294967118 0 current values for metrics (RAM; local node only) +4294967248 4294967118 0 running sessions visible by current user (RAM; local node only) +4294967249 4294967118 0 running user transactions visible by the current user (RAM; local node only) +4294967250 4294967118 0 running queries visible by current user (RAM; local node only) +4294967252 4294967118 0 DistSQL remote flows information (RAM; local node only) +4294967253 4294967118 0 contention information (RAM; local node only) +4294967254 4294967118 0 acquired table leases (RAM; local node only) +4294967255 4294967118 0 store details and status (cluster RPC; expensive!) +4294967256 4294967118 0 node details across the entire cluster (cluster RPC; expensive!) +4294967257 4294967118 0 decoded job metadata from system.jobs (KV scan) +4294967258 4294967118 0 in-flight spans (RAM; local node only) +4294967259 4294967118 0 cluster-wide index usage statistics (in-memory, not durable).Querying this table is an expensive operation since it creates acluster-wide RPC fanout. +4294967260 4294967118 0 key spans per table index +4294967261 4294967118 0 index columns for all indexes accessible by current user in current database (KV scan) +4294967262 4294967118 0 cluster-wide transaction contention events. Querying this table is an +4294967263 4294967118 0 locally known edges in the gossip network (RAM; local node only) +4294967264 4294967118 0 locally known gossiped node liveness (RAM; local node only) +4294967265 4294967118 0 locally known gossiped health alerts (RAM; local node only) +4294967266 4294967118 0 locally known gossiped node details (RAM; local node only) +4294967267 4294967118 0 node liveness status, as seen by kv +4294967268 4294967118 0 forward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan) +4294967269 4294967118 0 telemetry counters (RAM; local node only) +4294967270 4294967118 0 databases accessible by the current user (KV scan) +4294967271 4294967118 0 CREATE statements for all user defined types accessible by the current user in current database (KV scan) +4294967272 4294967118 0 CREATE and ALTER statements for all tables accessible by current user in current database (KV scan) +4294967273 4294967118 0 CREATE statements for all user defined schemas accessible by the current user in current database (KV scan) +4294967274 4294967118 0 CREATE statements for all user-defined functions +4294967275 4294967118 0 cluster-wide transaction statistics that have not yet been flushed to system tables. Querying this table is a somewhat expensive operation since it creates a cluster-wide RPC-fanout. +4294967276 4294967118 0 cluster-wide statement statistics that have not yet been flushed to system tables. Querying this table is a somewhat expensive operation since it creates a cluster-wide RPC-fanout. +4294967277 4294967118 0 cluster settings (RAM) +4294967278 4294967118 0 running sessions visible to current user (cluster RPC; expensive!) +4294967279 4294967118 0 running user transactions visible by the current user (cluster RPC; expensive!) +4294967280 4294967118 0 running queries visible by current user (cluster RPC; expensive!) +4294967281 4294967118 0 cluster-wide locks held in lock tables. Querying this table is an +4294967283 4294967118 0 DistSQL remote flows information (cluster RPC; expensive!) +4294967284 4294967118 0 contention information (cluster RPC; expensive!) +4294967288 4294967118 0 like system.zones but overlaid with in-txn in-memory changes +4294967289 4294967118 0 like system.namespace but overlaid with in-txn in-memory changes +4294967290 4294967118 0 like system.descriptor but overlaid with in-txn in-memory changes and including virtual objects +4294967291 4294967118 0 like system.comments but overlaid with in-txn in-memory changes and including virtual objects +4294967292 4294967118 0 built-in functions (RAM/static) +4294967293 4294967118 0 detailed identification strings (RAM, local node only) +4294967294 4294967118 0 backward inter-descriptor dependencies starting from tables accessible by current user in current database (KV scan) ## pg_catalog.pg_shdescription @@ -3208,7 +3210,7 @@ query OTOOTBBOOOOOOOO colnames SELECT * FROM pg_catalog.pg_operator where oprname='+' and oprleft='float8'::regtype ---- oid oprname oprnamespace oprowner oprkind oprcanmerge oprcanhash oprleft oprright oprresult oprcom oprnegate oprcode oprrest oprjoin -74817020 + 4294967132 NULL b false false 701 701 701 NULL NULL NULL NULL NULL +74817020 + 4294967130 NULL b false false 701 701 701 NULL NULL NULL NULL NULL # Verify proper functionality of system information functions. @@ -4054,7 +4056,7 @@ indoption query TTI SELECT database_name, descriptor_name, descriptor_id from test.crdb_internal.create_statements where descriptor_name = 'pg_views' ---- -test pg_views 4294967003 +test pg_views 4294967001 # Verify INCLUDED columns appear in pg_index. See issue #59563 statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/show_source b/pkg/sql/logictest/testdata/logic_test/show_source index 95a4db7c1a1a..7e8d66373c37 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_source +++ b/pkg/sql/logictest/testdata/logic_test/show_source @@ -450,10 +450,16 @@ testuser · {} query TTTI colnames -SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE system.descriptor] +SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM CURRENT_CATALOG] ---- start_key end_key replicas lease_holder -NULL NULL {1} 1 +/Table/53 /Max {1} 1 + +query TTTI colnames +SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE system.descriptor] +---- +start_key end_key replicas lease_holder +…/ …/ {1} 1 statement ok CREATE INDEX ix ON foo(x) @@ -461,8 +467,8 @@ CREATE INDEX ix ON foo(x) query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX foo@ix] ---- -start_key end_key replicas lease_holder -NULL NULL {1} 1 +start_key end_key replicas lease_holder +…/ {1} 1 query TTTTTTT colnames SELECT * FROM [SHOW TRACE FOR SESSION] LIMIT 0 diff --git a/pkg/sql/logictest/testdata/logic_test/split_at b/pkg/sql/logictest/testdata/logic_test/split_at index abaea65db4b6..926796b0f500 100644 --- a/pkg/sql/logictest/testdata/logic_test/split_at +++ b/pkg/sql/logictest/testdata/logic_test/split_at @@ -8,8 +8,8 @@ CREATE TABLE t (a INT PRIMARY KEY) query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t] ---- -start_key end_key replicas lease_holder -NULL NULL {1} 1 +start_key end_key replicas lease_holder + {1} 1 query TTT colnames ALTER TABLE t SPLIT AT VALUES (1), (10) @@ -21,10 +21,10 @@ key pretty split_enforced_until query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE t] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /10 {1} 1 -/10 NULL {1} 1 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/10 {1} 1 +…/1/10 {1} 1 statement ok DROP TABLE t diff --git a/pkg/sql/logictest/testdata/logic_test/sql_keys b/pkg/sql/logictest/testdata/logic_test/sql_keys index e9a39db25ed1..ba153b214dc3 100644 --- a/pkg/sql/logictest/testdata/logic_test/sql_keys +++ b/pkg/sql/logictest/testdata/logic_test/sql_keys @@ -10,7 +10,7 @@ ALTER TABLE t SPLIT AT VALUES (0) # Get the range that contains this table. let $rangeid -SELECT range_id FROM crdb_internal.ranges WHERE table_name = 't' +SELECT range_id FROM [SHOW RANGES FROM TABLE t] OFFSET 1 LIMIT 1 let $tableid SELECT id FROM system.namespace WHERE name = 't' @@ -52,7 +52,7 @@ INSERT INTO t2 (SELECT * FROM generate_series(1, 4096)); ALTER TABLE t2 SPLIT AT VALUES (0) let $rangeid -SELECT range_id FROM crdb_internal.ranges WHERE table_name = 't2' +SELECT range_id FROM [SHOW RANGES FROM TABLE t2] OFFSET 1 LIMIT 1 let $tableid SELECT id FROM system.namespace WHERE name = 't2' diff --git a/pkg/sql/logictest/testdata/logic_test/table b/pkg/sql/logictest/testdata/logic_test/table index 28d2366c5383..1e8f6ff48940 100644 --- a/pkg/sql/logictest/testdata/logic_test/table +++ b/pkg/sql/logictest/testdata/logic_test/table @@ -584,6 +584,7 @@ gossip_liveness NULL gossip_network NULL gossip_nodes NULL index_columns NULL +index_spans NULL index_usage_statistics NULL invalid_objects NULL jobs NULL @@ -622,6 +623,7 @@ super_regions NULL table_columns NULL table_indexes NULL table_row_statistics NULL +table_spans NULL tables NULL tenant_usage_details NULL transaction_contention_events NULL diff --git a/pkg/sql/multitenant_admin_function_test.go b/pkg/sql/multitenant_admin_function_test.go index 73a23384982f..f9b7722dc3de 100644 --- a/pkg/sql/multitenant_admin_function_test.go +++ b/pkg/sql/multitenant_admin_function_test.go @@ -377,7 +377,9 @@ func TestTruncateTable(t *testing.T) { testServer, cleanup := createTestServer(t) defer cleanup() db := createSystemTenantDB(t, testServer) - execQueries(db, "system", [][]string{{"", "/1"}, {"/1", ""}}) + execQueries(db, "system", [][]string{ + {"", "…/1"}, + {"…/1", ""}}) }() // Test secondary tenant. @@ -390,6 +392,9 @@ func TestTruncateTable(t *testing.T) { true, /* allowSplitAndScatter */ false, /* skipSQLSystemTenantCheck */ ) - execQueries(db, "secondary", [][]string{{"", "/104/2/1"}, {"/104/2/1", ""}}) + execQueries(db, "secondary", [][]string{ + {"", "…/104/2/1"}, + {"…/104/2/1", ""}, + }) }() } diff --git a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize index 0490d665616c..f45e46c2b9ee 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize +++ b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize @@ -29,23 +29,23 @@ ALTER TABLE kw EXPERIMENTAL_RELOCATE SELECT ARRAY[i], i FROM generate_series(1, query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv] ---- -NULL /1 {1} 1 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 + …/1/1 {1} 1 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify data placement. query TTTI rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kw] ---- -NULL /1 {5} 5 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 + …/1/1 {5} 5 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify that EXPLAIN ANALYZE (DISTSQL) works in a distributed setting. query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg index 42d7e54f975b..e2377d349c37 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg @@ -16,17 +16,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 # Verify that all aggregate functions that we expect to have multi-stage # execution do, in fact, get planned with 2 stages. @@ -813,17 +813,17 @@ ALTER TABLE sorted_data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE sorted_data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 query T EXPLAIN (DISTSQL) SELECT a, max(b) FROM sorted_data GROUP BY a @@ -1003,17 +1003,17 @@ ALTER TABLE data2 EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data2] ---- -start_key end_key replicas lease_holder -NULL /1/1 {2} 2 -/1/1 /1/2 {5} 5 -/1/2 /1/3 {5} 5 -/1/3 /1/4 {5} 5 -/1/4 /1/5 {5} 5 -/1/5 /1/6 {5} 5 -/1/6 /1/7 {5} 5 -/1/7 /1/8 {5} 5 -/1/8 /1/9 {5} 5 -/1/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1/1 {2} 2 +…/1/1/1 …/1/1/2 {5} 5 +…/1/1/2 …/1/1/3 {5} 5 +…/1/1/3 …/1/1/4 {5} 5 +…/1/1/4 …/1/1/5 {5} 5 +…/1/1/5 …/1/1/6 {5} 5 +…/1/1/6 …/1/1/7 {5} 5 +…/1/1/7 …/1/1/8 {5} 5 +…/1/1/8 …/1/1/9 {5} 5 +…/1/1/9 {5} 5 query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on index 58fdfe2a73dd..003ba573b859 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on @@ -46,23 +46,23 @@ ALTER TABLE abc EXPERIMENTAL_RELOCATE VALUES query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE xyz] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /4 {2} 2 -/4 /6 {3} 3 -/6 /7 {4} 4 -/7 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/4 {2} 2 +…/1/4 …/1/6 {3} 3 +…/1/6 …/1/7 {4} 4 +…/1/7 {5} 5 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE abc] ---- -start_key end_key replicas lease_holder -NULL /NULL/NULL/NULL {5} 5 -/NULL/NULL/NULL /"1"/"1"/"2" {1} 1 -/"1"/"1"/"2" /"1"/"2"/"2" {2} 2 -/"1"/"2"/"2" /"2"/"3"/"4" {3} 3 -/"2"/"3"/"4" /"3"/"4"/"5" {4} 4 -/"3"/"4"/"5" NULL {5} 5 +start_key end_key replicas lease_holder + …/1/NULL/NULL/NULL {5} 5 +…/1/NULL/NULL/NULL …/1/"1"/"1"/"2" {1} 1 +…/1/"1"/"1"/"2" …/1/"1"/"2"/"2" {2} 2 +…/1/"1"/"2"/"2" …/1/"2"/"3"/"4" {3} 3 +…/1/"2"/"3"/"4" …/1/"3"/"4"/"5" {4} 4 +…/1/"3"/"4"/"5" {5} 5 query T EXPLAIN (VERBOSE) SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin index 847600fa0b27..ea9ed61293bb 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin @@ -15,12 +15,12 @@ ALTER INDEX t@v EXPERIMENTAL_RELOCATE query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM INDEX t@v] ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -/10 /20 {2} 2 -/20 /30 {3} 3 -/30 /40 {4} 4 -/40 NULL {5} 5 +start_key end_key replicas lease_holder + …/10 {1} 1 +…/10 …/20 {2} 2 +…/20 …/30 {3} 3 +…/30 …/40 {4} 4 +…/40 {5} 5 query T EXPLAIN (DISTSQL) SELECT * FROM t WHERE v > 10 AND v < 50 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index index 23a101cbf392..379c36d21066 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index @@ -65,20 +65,20 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX json_tab@primary] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -/10 /20 {2} 2 -/20 NULL {3} 3 +start_key end_key replicas lease_holder + …/10 {1} 1 +…/10 …/20 {2} 2 +…/20 …/ {3} 3 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE json_tab] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -· NULL {1} 1 -/10 /20 {2} 2 -/20 · {3} 3 +start_key end_key replicas lease_holder + …/1/10 {1} 1 +…/2 {1} 1 +…/1/10 …/1/20 {2} 2 +…/1/20 …/2 {3} 3 # Filter with a fully-specified array. This should use a zigzag join. query T @@ -205,18 +205,18 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX array_tab@primary] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /3 {1} 1 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/3 {1} 1 +…/3 …/ {3} 3 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE array_tab] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /3 {1} 1 -· NULL {1} 1 -/3 · {3} 3 +start_key end_key replicas lease_holder + …/1/3 {1} 1 +…/2 {1} 1 +…/1/3 …/2 {3} 3 # This should use a zigzag join. query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join index d45e6f8e4af5..409a60faba65 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join @@ -16,17 +16,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 # ensure merge joins are planned when there's orderings. query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join index 275fa2d98fef..e757243a5a4d 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join @@ -105,29 +105,29 @@ ALTER TABLE grandchild2 EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE parent1] ---- -start_key end_key replicas lease_holder -NULL /8 {1} 1 -/8 /16 {1} 1 -/16 /24 {1} 1 -/24 /32 {1} 1 -/32 NULL {1} 1 +start_key end_key replicas lease_holder + …/1/8 {1} 1 +…/1/8 …/1/16 {1} 1 +…/1/16 …/1/24 {1} 1 +…/1/24 …/1/32 {1} 1 +…/1/32 {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE child1] ---- -start_key end_key replicas lease_holder -NULL /4/44 {1} 1 -/4/44 /12/52 {1} 1 -/12/52 /20/60 {1} 1 -/20/60 /28/68 {1} 1 -/28/68 /36/76 {1} 1 -/36/76 NULL {1} 1 +start_key end_key replicas lease_holder + …/1/4/44 {1} 1 +…/1/4/44 …/1/12/52 {1} 1 +…/1/12/52 …/1/20/60 {1} 1 +…/1/20/60 …/1/28/68 {1} 1 +…/1/28/68 …/1/36/76 {1} 1 +…/1/36/76 {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE grandchild1] ---- -start_key end_key replicas lease_holder -NULL NULL {1} 1 +start_key end_key replicas lease_holder + {1} 1 ############### # Merge joins # @@ -752,17 +752,17 @@ ALTER TABLE outer_p1 EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE outer_p1] ---- -start_key end_key replicas lease_holder -NULL /0 {5} 5 -/0 /5 {1} 1 -/5 /10 {2} 2 -/10 /15 {3} 3 -/15 /20 {4} 4 -/20 /25 {1} 1 -/25 /30 {2} 2 -/30 /35 {3} 3 -/35 /40 {4} 4 -/40 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/0 {5} 5 +…/1/0 …/1/5 {1} 1 +…/1/5 …/1/10 {2} 2 +…/1/10 …/1/15 {3} 3 +…/1/15 …/1/20 {4} 4 +…/1/20 …/1/25 {1} 1 +…/1/25 …/1/30 {2} 2 +…/1/30 …/1/35 {3} 3 +…/1/35 …/1/40 {4} 4 +…/1/40 {5} 5 ### Begin OUTER queries diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index eebaf51c9c40..859494a21076 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -71,17 +71,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 query T EXPLAIN (DISTSQL) CREATE STATISTICS s1 ON a FROM data diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables index 633cd17bf74f..b7550ee84008 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables @@ -26,18 +26,18 @@ ALTER TABLE NumToStr EXPERIMENTAL_RELOCATE query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToSquare] ---- -start_key end_key replicas lease_holder -NULL NULL {1} 1 +start_key end_key replicas lease_holder + {1} 1 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE NumToStr] ---- -start_key end_key replicas lease_holder -NULL /2000 {1} 1 -/2000 /4000 {2} 2 -/4000 /6000 {3} 3 -/6000 /8000 {4} 4 -/8000 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2000 {1} 1 +…/1/2000 …/1/4000 {2} 2 +…/1/4000 …/1/6000 {3} 3 +…/1/6000 …/1/8000 {4} 4 +…/1/8000 {5} 5 # # -- Basic tests -- diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality index 82f9d5bceaa2..2a06a6582d76 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality @@ -23,12 +23,12 @@ ALTER TABLE xyz EXPERIMENTAL_RELOCATE VALUES query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE xyz] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /4 {2} 2 -/4 /6 {3} 3 -/6 /7 {4} 4 -/7 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/4 {2} 2 +…/1/4 …/1/6 {3} 3 +…/1/6 …/1/7 {4} 4 +…/1/7 {5} 5 query T EXPLAIN (VERBOSE) SELECT x, y, z, ordinality FROM xyz WITH ORDINALITY diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans index dd88a602011f..05517a652b29 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans @@ -96,11 +96,11 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE p1] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /0 {3} 3 -/0 /2 {4} 4 -/2 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/2/0 {3} 3 +…/2/0 …/2/2 {4} 4 +…/2/2 {5} 5 # Indexes @@ -108,21 +108,21 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM INDEX b] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /0 {3} 3 -/0 /2 {4} 4 -/2 NULL {5} 5 +start_key end_key replicas lease_holder + …/0 {3} 3 +…/0 …/2 {4} 4 +…/2 {5} 5 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE p2] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /0 {1} 1 -· /2 {1} 1 -/0 /2 {1} 1 -/2 NULL {1} 1 -/2 · {3} 3 +start_key end_key replicas lease_holder + …/1/0 {1} 1 +…/1/0 …/1/2 {1} 1 +…/2 …/2/2 {1} 1 +…/2/2 {1} 1 +…/1/2 …/2 {3} 3 ############### # Query tests # diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union index 18ace61e686a..323de9b60600 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union @@ -21,12 +21,12 @@ ALTER TABLE xyz EXPERIMENTAL_RELOCATE VALUES query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE xyz] ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 subtest Union diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_window b/pkg/sql/opt/exec/execbuilder/testdata/distsql_window index 6e357910dee9..bf4a7b790b8a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_window +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_window @@ -16,17 +16,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 # Verify that the window functions with the same PARTITION BY clause are # evaluated as a single distributed windower stage followed by a couple of diff --git a/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node b/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node index a9bd33d6fa29..f7006d8a6324 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node +++ b/pkg/sql/opt/exec/execbuilder/testdata/experimental_distsql_planning_5node @@ -21,25 +21,25 @@ ALTER TABLE kw EXPERIMENTAL_RELOCATE SELECT ARRAY[i], i FROM generate_series(1, query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify data placement. query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kw] ---- -start_key end_key replicas lease_holder -NULL /1 {5} 5 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {5} 5 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 statement ok SET experimental_distsql_planning = always diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans index b604a4506fe6..d8d16bda6b04 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans @@ -35,25 +35,25 @@ ALTER TABLE kw EXPERIMENTAL_RELOCATE SELECT ARRAY[i], i FROM generate_series(1, query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kv] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # Verify data placement. query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE kw] ---- -start_key end_key replicas lease_holder -NULL /1 {5} 5 -/1 /2 {1} 1 -/2 /3 {2} 2 -/3 /4 {3} 3 -/4 /5 {4} 4 -/5 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {5} 5 +…/1/1 …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 …/1/4 {3} 3 +…/1/4 …/1/5 {4} 4 +…/1/5 {5} 5 # This query verifies stat collection for the tableReader, mergeJoiner, and # aggregator. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist index 3c6bbe376cd9..c86bea2f09ab 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial_dist @@ -102,9 +102,9 @@ ALTER INDEX geo_table@geom_index EXPERIMENTAL_RELOCATE VALUES (ARRAY[2], 1152921 query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX geo_table@geom_index] ---- -start_key end_key replicas lease_holder -NULL /1152921574000000000 {1} 1 -/1152921574000000000 NULL {2} 2 +start_key end_key replicas lease_holder + …/1152921574000000000 {1} 1 +…/1152921574000000000 {2} 2 # Distributed. TODO(treilly): This claims to be distributed, but it isn't. What gives? query T @@ -171,9 +171,9 @@ ALTER INDEX geo_table@geom_index EXPERIMENTAL_RELOCATE VALUES (ARRAY[2], 1) query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX geo_table@geom_index] ---- -start_key end_key replicas lease_holder -NULL /1152921574000000000 {2} 2 -/1152921574000000000 NULL {2} 2 +start_key end_key replicas lease_holder + …/1152921574000000000 {2} 2 +…/1152921574000000000 {2} 2 # Filtering is placed at node 2. We need a retry here to account for possibly # stale dist sender caches. @@ -242,16 +242,16 @@ SET CLUSTER SETTING sql.spatial.experimental_box2d_comparison_operators.enabled query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX geo_table@geom_index] ---- -start_key end_key replicas lease_holder -NULL /1152921574000000000 {2} 2 -/1152921574000000000 NULL {2} 2 +start_key end_key replicas lease_holder + …/1152921574000000000 {2} 2 +…/1152921574000000000 {2} 2 query ITTTI colnames,rowsort SELECT range_id, start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX geo_table@primary] ORDER BY lease_holder, start_key ---- -range_id start_key end_key replicas lease_holder -54 NULL NULL {2} 2 +range_id start_key end_key replicas lease_holder +54 {2} 2 # We should see a distributed execution (though need to retry to purge possibly # stale dist sender caches). diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_json_array_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_json_array_dist index 0803a95708d7..1711bfd0f7da 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_json_array_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_json_array_dist @@ -68,10 +68,10 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW EXPERIMENTAL_RANGES FROM INDEX json_inv] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -/10 /20 {2} 2 -/20 NULL {3} 3 +start_key end_key replicas lease_holder +…/ …/10 {1} 1 +…/10 …/20 {2} 2 +…/20 {3} 3 statement ok ALTER TABLE json_tab VALIDATE CONSTRAINT check_c @@ -354,10 +354,10 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW EXPERIMENTAL_RANGES FROM INDEX arr_inv] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -/10 /20 {2} 2 -/20 NULL {3} 3 +start_key end_key replicas lease_holder +…/ …/10 {1} 1 +…/10 …/20 {2} 2 +…/20 {3} 3 query T EXPLAIN (DISTSQL) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist index fa355c202d3e..d2c5b8489178 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist @@ -38,10 +38,10 @@ ALTER TABLE ltable EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1), (ARRAY[2], 2), (A query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 {3} 3 query T EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec index 6edbe8a6c3b3..8809cedbc339 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial_dist_vec @@ -38,10 +38,10 @@ ALTER TABLE ltable EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1), (ARRAY[2], 2), (A query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE ltable] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 {3} 3 query T EXPLAIN (VEC) SELECT lk, rk FROM ltable JOIN rtable@geom_index diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist index 5476ff2aa377..6b4949c9a45a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_json_array_dist @@ -64,10 +64,10 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX json_tab@primary] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /10 {1} 1 -/10 /20 {2} 2 -/20 NULL {3} 3 +start_key end_key replicas lease_holder + …/10 {1} 1 +…/10 …/20 {2} 2 +…/20 …/ {3} 3 # This query performs an inverted join. query T @@ -289,9 +289,9 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM INDEX array_tab@primary] ORDER BY lease_holder, start_key ---- -start_key end_key replicas lease_holder -NULL /3 {1} 1 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/3 {1} 1 +…/3 …/ {3} 3 # This query performs an inverted join. query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist index a19a80a2bdc7..b1c1ebb7137d 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_multi_column_dist @@ -80,10 +80,10 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW EXPERIMENTAL_RANGES FROM TABLE j2] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /44 {1} 1 -/44 /88 {2} 2 -/88 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/44 {1} 1 +…/1/44 …/1/88 {2} 2 +…/1/88 {3} 3 # This query performs an inverted join. query T @@ -160,10 +160,10 @@ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder FROM [SHOW EXPERIMENTAL_RANGES FROM TABLE a2] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /8 {1} 1 -/8 /16 {2} 2 -/16 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/8 {1} 1 +…/1/8 …/1/16 {2} 2 +…/1/16 {3} 3 # This query performs an inverted join. query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join index 1d60e9f969ad..01db8a908737 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join @@ -427,17 +427,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 query T EXPLAIN (VERBOSE) @@ -609,8 +609,8 @@ vectorized: true query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW RANGES FROM TABLE books] ---- -start_key end_key replicas lease_holder -NULL NULL {5} 5 +start_key end_key replicas lease_holder + {5} 5 query T EXPLAIN (DISTSQL) SELECT DISTINCT authors.name FROM books AS b1, books2 AS b2, authors WHERE b1.title = b2.title AND authors.book = b1.title AND b1.shelf <> b2.shelf diff --git a/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec b/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec index 1c7d6dfd106b..a4a09fae7527 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec +++ b/pkg/sql/opt/exec/execbuilder/testdata/merge_join_dist_vec @@ -29,18 +29,18 @@ ALTER TABLE r EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 2), (ARRAY[2], 3), (ARRAY[ query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE l] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -NULL /2 {1} 1 -/2 /3 {2} 2 -/3 NULL {3} 3 +start_key end_key replicas lease_holder + …/1/2 {1} 1 +…/1/2 …/1/3 {2} 2 +…/1/3 {3} 3 query TTTI colnames SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE r] ORDER BY lease_holder ---- -start_key end_key replicas lease_holder -/2 /3 {1} 1 -/3 NULL {2} 2 -NULL /2 {3} 3 +start_key end_key replicas lease_holder +…/1/2 …/1/3 {1} 1 +…/1/3 {2} 2 + …/1/2 {3} 3 query T EXPLAIN (DISTSQL) SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel b/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel index 946ae042557f..e3bfa5e8fba7 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel +++ b/pkg/sql/opt/exec/execbuilder/testdata/scan_parallel @@ -16,17 +16,17 @@ ALTER TABLE data EXPERIMENTAL_RELOCATE query TTTI colnames,rowsort SELECT start_key, end_key, replicas, lease_holder FROM [SHOW RANGES FROM TABLE data] ---- -start_key end_key replicas lease_holder -NULL /1 {1} 1 -/1 /2 {2} 2 -/2 /3 {3} 3 -/3 /4 {4} 4 -/4 /5 {5} 5 -/5 /6 {1} 1 -/6 /7 {2} 2 -/7 /8 {3} 3 -/8 /9 {4} 4 -/9 NULL {5} 5 +start_key end_key replicas lease_holder + …/1/1 {1} 1 +…/1/1 …/1/2 {2} 2 +…/1/2 …/1/3 {3} 3 +…/1/3 …/1/4 {4} 4 +…/1/4 …/1/5 {5} 5 +…/1/5 …/1/6 {1} 1 +…/1/6 …/1/7 {2} 2 +…/1/7 …/1/8 {3} 3 +…/1/8 …/1/9 {4} 4 +…/1/9 {5} 5 # Populate the range cache. statement ok diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 422f748aed23..a6843313e80b 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -828,6 +828,9 @@ func (u *sqlSymUnion) functionObj() tree.FuncObj { func (u *sqlSymUnion) functionObjs() tree.FuncObjs { return u.val.(tree.FuncObjs) } +func (u *sqlSymUnion) showRangesOpts() *tree.ShowRangesOptions { + return u.val.(*tree.ShowRangesOptions) +} %} // NB: the %token definitions must come before the %type definitions in this @@ -866,7 +869,7 @@ func (u *sqlSymUnion) functionObjs() tree.FuncObjs { %token CURRENT_USER CURSOR CYCLE %token DATA DATABASE DATABASES DATE DAY DEBUG_PAUSE_ON DEC DECIMAL DEFAULT DEFAULTS DEFINER -%token DEALLOCATE DECLARE DEFERRABLE DEFERRED DELETE DELIMITER DEPENDS DESC DESTINATION DETACHED +%token DEALLOCATE DECLARE DEFERRABLE DEFERRED DELETE DELIMITER DEPENDS DESC DESTINATION DETACHED DETAILS %token DISCARD DISTINCT DO DOMAIN DOUBLE DROP %token ELSE ENCODING ENCRYPTED ENCRYPTION_PASSPHRASE END ENUM ENUMS ESCAPE EXCEPT EXCLUDE EXCLUDING @@ -1598,6 +1601,7 @@ func (u *sqlSymUnion) functionObjs() tree.FuncObjs { %type <*tree.LabelSpec> label_spec +%type <*tree.ShowRangesOptions> opt_show_ranges_options show_ranges_options // Precedence: lowest to highest %nonassoc VALUES // see value_clause @@ -7771,24 +7775,83 @@ show_range_for_row_stmt: // %Help: SHOW RANGES - list ranges // %Category: Misc // %Text: -// SHOW RANGES FROM TABLE -// SHOW RANGES FROM INDEX [ @ ] +// SHOW RANGES FROM DATABASE [ WITH ] +// SHOW RANGES FROM CURRENT_CATALOG [ WITH ] +// SHOW RANGES FROM TABLE [ WITH ] +// SHOW RANGES FROM INDEX [ @ ] [ WITH ] +// +// Options: +// INDEXES +// TABLES +// DETAILS show_ranges_stmt: - SHOW RANGES FROM TABLE table_name + SHOW RANGES FROM INDEX table_index_name opt_show_ranges_options + { + $$.val = &tree.ShowRanges{Source: tree.ShowRangesIndex, TableOrIndex: $5.tableIndexName(), Options: $6.showRangesOpts()} + } +| SHOW RANGES FROM TABLE table_name opt_show_ranges_options { name := $5.unresolvedObjectName().ToTableName() - $$.val = &tree.ShowRanges{TableOrIndex: tree.TableIndexName{Table: name}} + $$.val = &tree.ShowRanges{Source: tree.ShowRangesTable, TableOrIndex: tree.TableIndexName{Table: name}, Options: $6.showRangesOpts()} } -| SHOW RANGES FROM INDEX table_index_name +| SHOW RANGES FROM DATABASE database_name opt_show_ranges_options { - $$.val = &tree.ShowRanges{TableOrIndex: $5.tableIndexName()} + $$.val = &tree.ShowRanges{Source: tree.ShowRangesDatabase, DatabaseName: tree.Name($5), Options: $6.showRangesOpts()} } -| SHOW RANGES FROM DATABASE database_name +| SHOW RANGES FROM CURRENT_CATALOG opt_show_ranges_options { - $$.val = &tree.ShowRanges{DatabaseName: tree.Name($5)} + $$.val = &tree.ShowRanges{Source: tree.ShowRangesCurrentDatabase, Options: $5.showRangesOpts()} } +| SHOW RANGES opt_show_ranges_options + { + $$.val = &tree.ShowRanges{Source: tree.ShowRangesCurrentDatabase, Options: $3.showRangesOpts()} + } +| SHOW CLUSTER RANGES opt_show_ranges_options + { + $$.val = &tree.ShowRanges{Source: tree.ShowRangesCluster, Options: $4.showRangesOpts()} + } +| SHOW CLUSTER RANGES error // SHOW HELP: SHOW RANGES | SHOW RANGES error // SHOW HELP: SHOW RANGES +opt_show_ranges_options: + /* EMPTY */ + { $$.val = &tree.ShowRangesOptions{} } +| WITH show_ranges_options + { $$.val = $2.showRangesOpts() } + +show_ranges_options: + TABLES { $$.val = &tree.ShowRangesOptions{Mode: tree.ExpandTables} } +| INDEXES { $$.val = &tree.ShowRangesOptions{Mode: tree.ExpandIndexes} } +| DETAILS { $$.val = &tree.ShowRangesOptions{Details: true} } +| EXPLAIN { $$.val = &tree.ShowRangesOptions{Explain: true} } +| show_ranges_options ',' TABLES + { + o := $1.showRangesOpts() + if o.Mode != 0 { return setErr(sqllex, errors.New("conflicting modes")) } + o.Mode = tree.ExpandTables + $$.val = o + } +| show_ranges_options ',' INDEXES + { + o := $1.showRangesOpts() + if o.Mode != 0 { return setErr(sqllex, errors.New("conflicting modes")) } + o.Mode = tree.ExpandIndexes + $$.val = o + } +| show_ranges_options ',' DETAILS + { + o := $1.showRangesOpts() + o.Details = true + $$.val = o + } +| show_ranges_options ',' EXPLAIN + { + o := $1.showRangesOpts() + o.Explain = true + $$.val = o + } + + // %Help: SHOW SURVIVAL GOAL - list survival goals // %Category: DDL // %Text: @@ -15573,6 +15636,7 @@ unreserved_keyword: | DEPENDS | DESTINATION | DETACHED +| DETAILS | DISCARD | DOMAIN | DOUBLE diff --git a/pkg/sql/parser/testdata/show b/pkg/sql/parser/testdata/show index 47ac07e0a6fa..3f7021c0e31e 100644 --- a/pkg/sql/parser/testdata/show +++ b/pkg/sql/parser/testdata/show @@ -1018,6 +1018,127 @@ SHOW RANGE FROM INDEX i FOR ROW ((1), (2)) -- fully parenthesized SHOW RANGE FROM INDEX i FOR ROW (_, _) -- literals removed SHOW RANGE FROM INDEX _ FOR ROW (1, 2) -- identifiers removed +parse +SHOW CLUSTER RANGES +---- +SHOW CLUSTER RANGES +SHOW CLUSTER RANGES -- fully parenthesized +SHOW CLUSTER RANGES -- literals removed +SHOW CLUSTER RANGES -- identifiers removed + +parse +SHOW CLUSTER RANGES WITH DETAILS +---- +SHOW CLUSTER RANGES WITH DETAILS +SHOW CLUSTER RANGES WITH DETAILS -- fully parenthesized +SHOW CLUSTER RANGES WITH DETAILS -- literals removed +SHOW CLUSTER RANGES WITH DETAILS -- identifiers removed + +parse +SHOW CLUSTER RANGES WITH INDEXES +---- +SHOW CLUSTER RANGES WITH INDEXES +SHOW CLUSTER RANGES WITH INDEXES -- fully parenthesized +SHOW CLUSTER RANGES WITH INDEXES -- literals removed +SHOW CLUSTER RANGES WITH INDEXES -- identifiers removed + +parse +SHOW CLUSTER RANGES WITH TABLES +---- +SHOW CLUSTER RANGES WITH TABLES +SHOW CLUSTER RANGES WITH TABLES -- fully parenthesized +SHOW CLUSTER RANGES WITH TABLES -- literals removed +SHOW CLUSTER RANGES WITH TABLES -- identifiers removed + +parse +SHOW CLUSTER RANGES WITH INDEXES, DETAILS +---- +SHOW CLUSTER RANGES WITH DETAILS, INDEXES -- normalized! +SHOW CLUSTER RANGES WITH DETAILS, INDEXES -- fully parenthesized +SHOW CLUSTER RANGES WITH DETAILS, INDEXES -- literals removed +SHOW CLUSTER RANGES WITH DETAILS, INDEXES -- identifiers removed + +parse +SHOW RANGES FROM DATABASE d +---- +SHOW RANGES FROM DATABASE d +SHOW RANGES FROM DATABASE d -- fully parenthesized +SHOW RANGES FROM DATABASE d -- literals removed +SHOW RANGES FROM DATABASE _ -- identifiers removed + +parse +SHOW RANGES FROM CURRENT_CATALOG +---- +SHOW RANGES FROM CURRENT_CATALOG +SHOW RANGES FROM CURRENT_CATALOG -- fully parenthesized +SHOW RANGES FROM CURRENT_CATALOG -- literals removed +SHOW RANGES FROM CURRENT_CATALOG -- identifiers removed + +parse +SHOW RANGES FROM DATABASE d WITH TABLES +---- +SHOW RANGES FROM DATABASE d WITH TABLES +SHOW RANGES FROM DATABASE d WITH TABLES -- fully parenthesized +SHOW RANGES FROM DATABASE d WITH TABLES -- literals removed +SHOW RANGES FROM DATABASE _ WITH TABLES -- identifiers removed + +parse +SHOW RANGES FROM DATABASE d WITH TABLES, DETAILS +---- +SHOW RANGES FROM DATABASE d WITH DETAILS, TABLES -- normalized! +SHOW RANGES FROM DATABASE d WITH DETAILS, TABLES -- fully parenthesized +SHOW RANGES FROM DATABASE d WITH DETAILS, TABLES -- literals removed +SHOW RANGES FROM DATABASE _ WITH DETAILS, TABLES -- identifiers removed + +parse +SHOW RANGES FROM DATABASE d WITH DETAILS +---- +SHOW RANGES FROM DATABASE d WITH DETAILS +SHOW RANGES FROM DATABASE d WITH DETAILS -- fully parenthesized +SHOW RANGES FROM DATABASE d WITH DETAILS -- literals removed +SHOW RANGES FROM DATABASE _ WITH DETAILS -- identifiers removed + +parse +SHOW RANGES FROM CURRENT_CATALOG WITH TABLES +---- +SHOW RANGES FROM CURRENT_CATALOG WITH TABLES +SHOW RANGES FROM CURRENT_CATALOG WITH TABLES -- fully parenthesized +SHOW RANGES FROM CURRENT_CATALOG WITH TABLES -- literals removed +SHOW RANGES FROM CURRENT_CATALOG WITH TABLES -- identifiers removed + +parse +SHOW RANGES FROM DATABASE d WITH INDEXES +---- +SHOW RANGES FROM DATABASE d WITH INDEXES +SHOW RANGES FROM DATABASE d WITH INDEXES -- fully parenthesized +SHOW RANGES FROM DATABASE d WITH INDEXES -- literals removed +SHOW RANGES FROM DATABASE _ WITH INDEXES -- identifiers removed + +parse +SHOW RANGES +---- +SHOW RANGES FROM CURRENT_CATALOG -- normalized! +SHOW RANGES FROM CURRENT_CATALOG -- fully parenthesized +SHOW RANGES FROM CURRENT_CATALOG -- literals removed +SHOW RANGES FROM CURRENT_CATALOG -- identifiers removed + +parse +SHOW RANGES WITH INDEXES +---- +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- normalized! +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- fully parenthesized +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- literals removed +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- identifiers removed + + +parse +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES +---- +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- fully parenthesized +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- literals removed +SHOW RANGES FROM CURRENT_CATALOG WITH INDEXES -- identifiers removed + parse SHOW RANGES FROM TABLE d.t ---- @@ -1042,6 +1163,30 @@ SHOW RANGES FROM TABLE t -- fully parenthesized SHOW RANGES FROM TABLE t -- literals removed SHOW RANGES FROM TABLE _ -- identifiers removed +parse +SHOW RANGES FROM TABLE t WITH DETAILS +---- +SHOW RANGES FROM TABLE t WITH DETAILS +SHOW RANGES FROM TABLE t WITH DETAILS -- fully parenthesized +SHOW RANGES FROM TABLE t WITH DETAILS -- literals removed +SHOW RANGES FROM TABLE _ WITH DETAILS -- identifiers removed + +parse +SHOW RANGES FROM TABLE t WITH DETAILS, INDEXES +---- +SHOW RANGES FROM TABLE t WITH DETAILS, INDEXES +SHOW RANGES FROM TABLE t WITH DETAILS, INDEXES -- fully parenthesized +SHOW RANGES FROM TABLE t WITH DETAILS, INDEXES -- literals removed +SHOW RANGES FROM TABLE _ WITH DETAILS, INDEXES -- identifiers removed + +parse +SHOW RANGES FROM TABLE t WITH INDEXES +---- +SHOW RANGES FROM TABLE t WITH INDEXES +SHOW RANGES FROM TABLE t WITH INDEXES -- fully parenthesized +SHOW RANGES FROM TABLE t WITH INDEXES -- literals removed +SHOW RANGES FROM TABLE _ WITH INDEXES -- identifiers removed + parse SHOW RANGES FROM INDEX d.t@i ---- diff --git a/pkg/sql/scatter_test.go b/pkg/sql/scatter_test.go index 714fe86f552b..aedcd8557c61 100644 --- a/pkg/sql/scatter_test.go +++ b/pkg/sql/scatter_test.go @@ -132,8 +132,7 @@ func TestScatterResponse(t *testing.T) { // the actual split boundaries. Wait until the table itself is split off // into its own range. testutils.SucceedsSoon(t, func() error { - row := r.QueryRow(t, `SELECT count(*) FROM crdb_internal.ranges_no_leases WHERE table_id = $1`, - tableDesc.GetID()) + row := r.QueryRow(t, `SELECT count(*) FROM [SHOW RANGES FROM TABLE test.t] WHERE start_key LIKE '%TableMin%'`) var nRanges int row.Scan(&nRanges) if nRanges != 1 { diff --git a/pkg/sql/sem/catconstants/constants.go b/pkg/sql/sem/catconstants/constants.go index d96668d973e0..bd7fa83b3f12 100644 --- a/pkg/sql/sem/catconstants/constants.go +++ b/pkg/sql/sem/catconstants/constants.go @@ -127,6 +127,7 @@ const ( CrdbInternalGossipNetworkTableID CrdbInternalTransactionContentionEvents CrdbInternalIndexColumnsTableID + CrdbInternalIndexSpansTableID CrdbInternalIndexUsageStatisticsTableID CrdbInternalInflightTraceSpanTableID CrdbInternalJobsTableID @@ -152,6 +153,7 @@ const ( CrdbInternalStmtStatsTableID CrdbInternalTableColumnsTableID CrdbInternalTableIndexesTableID + CrdbInternalTableSpansTableID CrdbInternalTablesTableID CrdbInternalTablesTableLastStatsID CrdbInternalTransactionStatsTableID diff --git a/pkg/sql/sem/tree/show.go b/pkg/sql/sem/tree/show.go index 3133b495b355..7e5a2ed02db5 100644 --- a/pkg/sql/sem/tree/show.go +++ b/pkg/sql/sem/tree/show.go @@ -704,22 +704,97 @@ func (node *ShowRoles) Format(ctx *FmtCtx) { // ShowRanges represents a SHOW RANGES statement. type ShowRanges struct { - TableOrIndex TableIndexName DatabaseName Name + TableOrIndex TableIndexName + Options *ShowRangesOptions + Source ShowRangesSource +} + +// ShowRangesSource represents the source of a SHOW RANGES statement. +type ShowRangesSource int8 + +const ( + // SHOW RANGES FROM CURRENT_CATALOG + ShowRangesCurrentDatabase ShowRangesSource = iota + // SHOW RANGES FROM DATABASE + ShowRangesDatabase + // SHOW RANGES FROM TABLE + ShowRangesTable + // SHOW RANGES FROM INDEX + ShowRangesIndex + // SHOW CLUSTER RANGES + ShowRangesCluster +) + +// ShowRangesOptions represents the WITH clause in SHOW RANGES. +type ShowRangesOptions struct { + Details bool + Explain bool + Mode ShowRangesMode } +// ShowRangesMode represents the WITH clause in SHOW RANGES. +type ShowRangesMode int8 + +const ( + // UniqueRanges tells to use just 1 row per range in the output. + UniqueRanges ShowRangesMode = 0 + // ExpandTables requests one row per table in the output. + ExpandTables ShowRangesMode = 1 + // ExpandIndexes requests one row per index in the output. + ExpandIndexes ShowRangesMode = 2 +) + // Format implements the NodeFormatter interface. func (node *ShowRanges) Format(ctx *FmtCtx) { - ctx.WriteString("SHOW RANGES FROM ") - if node.DatabaseName != "" { - ctx.WriteString("DATABASE ") - ctx.FormatNode(&node.DatabaseName) - } else if node.TableOrIndex.Index != "" { - ctx.WriteString("INDEX ") - ctx.FormatNode(&node.TableOrIndex) - } else { - ctx.WriteString("TABLE ") - ctx.FormatNode(&node.TableOrIndex) + ctx.WriteString("SHOW ") + if node.Source == ShowRangesCluster { + ctx.WriteString("CLUSTER ") + } + ctx.WriteString("RANGES") + if node.Source != ShowRangesCluster { + ctx.WriteString(" FROM ") + switch node.Source { + case ShowRangesCurrentDatabase: + ctx.WriteString("CURRENT_CATALOG") + case ShowRangesDatabase: + ctx.WriteString("DATABASE ") + ctx.FormatNode(&node.DatabaseName) + case ShowRangesIndex: + ctx.WriteString("INDEX ") + ctx.FormatNode(&node.TableOrIndex) + case ShowRangesTable: + ctx.WriteString("TABLE ") + ctx.FormatNode(&node.TableOrIndex) + } + } + ctx.FormatNode(node.Options) +} + +// Format implements the NodeFormatter interface. +func (node *ShowRangesOptions) Format(ctx *FmtCtx) { + if !node.Details && !node.Explain && node.Mode == UniqueRanges { + return + } + ctx.WriteString(" WITH ") + comma := "" + if node.Details { + ctx.WriteString("DETAILS") + comma = ", " + } + if node.Explain { + ctx.WriteString(comma) + ctx.WriteString("EXPLAIN") + comma = ", " + } + if node.Mode != UniqueRanges { + ctx.WriteString(comma) + switch node.Mode { + case ExpandTables: + ctx.WriteString("TABLES") + case ExpandIndexes: + ctx.WriteString("INDEXES") + } } } diff --git a/pkg/sql/tests/truncate_test.go b/pkg/sql/tests/truncate_test.go index 25af91e9ce4f..85fa56037467 100644 --- a/pkg/sql/tests/truncate_test.go +++ b/pkg/sql/tests/truncate_test.go @@ -421,7 +421,7 @@ ALTER INDEX a_b_idx SPLIT AT VALUES(1000), (2000), (3000), (4000), (5000), (6000 // succeeds-soon block here and below. testutils.SucceedsSoon(t, func() error { row := tc.Conns[0].QueryRowContext(ctx, ` -SELECT count(*) FROM crdb_internal.ranges_no_leases WHERE table_id = 'a'::regclass`) +SELECT count(*) FROM [SHOW RANGES FROM TABLE a]`) assert.NoError(t, row.Err()) var nRanges int @@ -443,7 +443,7 @@ SELECT count(*) FROM crdb_internal.ranges_no_leases WHERE table_id = 'a'::regcla testutils.SucceedsSoon(t, func() error { row := tc.Conns[0].QueryRowContext(ctx, ` -SELECT count(*) FROM crdb_internal.ranges_no_leases WHERE table_id = 'a'::regclass`) +SELECT count(*) FROM [SHOW RANGES FROM TABLE a]`) assert.NoError(t, row.Err()) var nRanges int diff --git a/pkg/sql/unsplit.go b/pkg/sql/unsplit.go index eb360a231c52..cc3e6deaab9f 100644 --- a/pkg/sql/unsplit.go +++ b/pkg/sql/unsplit.go @@ -88,31 +88,20 @@ type unsplitAllRun struct { func (n *unsplitAllNode) startExec(params runParams) error { // Use the internal executor to retrieve the split keys. - statement := ` - SELECT - start_key - FROM - crdb_internal.ranges_no_leases - WHERE - database_name=$1 AND table_name=$2 AND index_name=$3 AND split_enforced_until IS NOT NULL - ` - _, dbDesc, err := params.p.Descriptors().GetImmutableDatabaseByID( - params.ctx, params.p.txn, n.tableDesc.GetParentID(), tree.DatabaseLookupFlags{AvoidLeased: true}, - ) - if err != nil { - return err - } - indexName := "" - if n.index.GetID() != n.tableDesc.GetPrimaryIndexID() { - indexName = n.index.GetName() - } + const statement = `SELECT r.start_key +FROM crdb_internal.ranges_no_leases r, + crdb_internal.index_spans s +WHERE s.descriptor_id = $1 + AND s.index_id = $2 + AND s.start_key < r.end_key + AND s.end_key > r.start_key + AND split_enforced_until IS NOT NULL` ie := params.p.ExecCfg().InternalExecutorFactory.NewInternalExecutor(params.SessionData()) it, err := ie.QueryIteratorEx( params.ctx, "split points query", params.p.txn, sessiondata.NoSessionDataOverride, statement, - dbDesc.GetName(), - n.tableDesc.GetName(), - indexName, + n.tableDesc.GetID(), + n.index.GetID(), ) if err != nil { return err