Improve compatibility of 'cardinality' field

This commit is contained in:
Robert Schulze 2023-07-04 16:44:34 +00:00
parent eb86f27482
commit 5c463838b7
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
3 changed files with 46 additions and 46 deletions

View File

@ -288,7 +288,7 @@ The statement produces a result table with the following structure:
- seq_in_index - Currently unused
- column_name - Currently unused
- collation - The sorting of the column in the index, `A` if ascending, `D` if descending, `NULL` if unsorted (Nullable(String))
- cardinality - Currently unused
- cardinality - An estimation of the index cardinality (number of unique values in the index). Currently always 0. (UInt64)
- sub_part - Always `NULL` because ClickHouse does not support index prefixes like MySQL (Nullable(String))
- packed - Always `NULL` because ClickHouse does not support packed (prefix-compressed) indexes like MySQL (Nullable(String))
- null - Currently unused
@ -310,11 +310,11 @@ Result:
``` text
┌─table─┬─non_unique─┬─key_name─┬─seq_in_index─┬─column_name─┬─collation─┬─cardinality─┬─sub_part─┬─packed─┬─null─┬─index_type───┬─comment─┬─index_comment─┬─visible─┬─expression─┐
│ tbl │ 0 │ blf_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ BLOOM_FILTER │ │ │ YES │ d, b │
│ tbl │ 0 │ mm1_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ MINMAX │ │ │ YES │ a, c, d │
│ tbl │ 0 │ mm2_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ MINMAX │ │ │ YES │ c, d, e │
│ tbl │ 0 │ PRIMARY │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ A │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ PRIMARY │ │ │ YES │ c, a │
│ tbl │ 0 │ set_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ SET │ │ │ YES │ e │
│ tbl │ 0 │ blf_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ BLOOM_FILTER │ │ │ YES │ d, b │
│ tbl │ 0 │ mm1_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ MINMAX │ │ │ YES │ a, c, d │
│ tbl │ 0 │ mm2_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ MINMAX │ │ │ YES │ c, d, e │
│ tbl │ 0 │ PRIMARY │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ A │ 0 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ PRIMARY │ │ │ YES │ c, a │
│ tbl │ 0 │ set_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ SET │ │ │ YES │ e │
└───────┴────────────┴──────────┴──────────────┴─────────────┴───────────┴─────────────┴──────────┴────────┴──────┴──────────────┴─────────┴───────────────┴─────────┴────────────┘
```

View File

@ -45,7 +45,7 @@ FROM (
NULL AS seq_in_index,
NULL AS column_name,
'A' AS collation,
NULL AS cardinality,
0 AS cardinality,
NULL AS sub_part,
NULL AS packed,
NULL AS null,
@ -66,7 +66,7 @@ FROM (
NULL AS seq_in_index,
NULL AS column_name,
NULL AS collation,
NULL AS cardinality,
0 AS cardinality,
NULL AS sub_part,
NULL AS packed,
NULL AS null,

View File

@ -1,45 +1,45 @@
--- Aliases of SHOW INDEX
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
--- EXTENDED
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
--- WHERE
--- Check with weird table names
$4@^7 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c
NULL 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c
\' 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c
\' 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c
$4@^7 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c
NULL 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c
\' 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c
\' 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c
--- Original table
tbl 0 blf_idx \N \N \N \N \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N SET YES e
tbl 0 blf_idx \N \N \N 0 \N \N \N BLOOM_FILTER YES d, b
tbl 0 mm1_idx \N \N \N 0 \N \N \N MINMAX YES a, c, d
tbl 0 mm2_idx \N \N \N 0 \N \N \N MINMAX YES c, d, e
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES c, a
tbl 0 set_idx \N \N \N 0 \N \N \N SET YES e
--- Equally named table in other database
tbl 0 mmi_idx \N \N \N \N \N \N \N MINMAX YES b
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES a
tbl 0 mmi_idx \N \N \N 0 \N \N \N MINMAX YES b
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES a
--- Short form
tbl 0 mmi_idx \N \N \N \N \N \N \N MINMAX YES b
tbl 0 PRIMARY \N \N A \N \N \N \N PRIMARY YES a
tbl 0 mmi_idx \N \N \N 0 \N \N \N MINMAX YES b
tbl 0 PRIMARY \N \N A 0 \N \N \N PRIMARY YES a