1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

record statistics_json test

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
This commit is contained in:
Michael Okoko
2021-06-16 09:54:34 +01:00
committed by Sergei Petrunia
parent 79cdb535da
commit 2373133f99

View File

@@ -0,0 +1,38 @@
#
# Test that JSON is a valid histogram type and we can store JSON strings in mysql.column_stats
#
drop table if exists t1;
set @save_histogram_type=@@histogram_type;
CREATE TABLE t1 (
a int NOT NULL PRIMARY KEY,
b varchar(32)
) ENGINE=MYISAM;
SET histogram_type='JSON';
SELECT @@histogram_type;
@@histogram_type
JSON
INSERT INTO t1 VALUES
(7, 'xxxxxxxxxxxxxxxxxxxxxxxxxx'),
(17, 'vvvvvvvvvvvvv');
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES();
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DESCRIBE mysql.column_stats;
Field Type Null Key Default Extra
db_name varchar(64) NO PRI NULL
table_name varchar(64) NO PRI NULL
column_name varchar(64) NO PRI NULL
min_value varbinary(255) YES NULL
max_value varbinary(255) YES NULL
nulls_ratio decimal(12,4) YES NULL
avg_length decimal(12,4) YES NULL
avg_frequency decimal(12,4) YES NULL
hist_size tinyint(3) unsigned YES NULL
hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON') YES NULL
histogram blob YES NULL
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 b vvvvvvvvvvvvv xxxxxxxxxxxxxxxxxxxxxxxxxx 0.0000 19.5000 1.0000 254 JSON {'hello': 'world'}
set histogram_type=@save_histogram_type;
DROP TABLE t1;