github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/dml/show/database_statistics.sql (about) 1 2 -- test system db table_number 3 4 show table_number from mo_task; 5 show table_number from information_schema; 6 show table_number from mysql; 7 show table_number from mo_catalog; 8 show table_number from system_metrics; 9 show table_number from system; 10 11 12 -- test system tables column_number 13 14 use mo_task; 15 show column_number from sys_async_task; 16 show column_number from sys_cron_task; 17 18 use information_schema; 19 show column_number from key_column_usage; 20 show column_number from columns; 21 show column_number from profiling; 22 show column_number from processlist; 23 show column_number from schemata; 24 show column_number from character_sets; 25 show column_number from triggers; 26 show column_number from tables; 27 show column_number from engines; 28 show column_number from routines; 29 show column_number from parameters; 30 show column_number from keywords; 31 32 use mysql; 33 show column_number from user; 34 show column_number from db; 35 show column_number from procs_priv; 36 show column_number from columns_priv; 37 show column_number from tables_priv; 38 39 use mo_catalog; 40 show column_number from mo_user; 41 show column_number from mo_account; 42 show column_number from mo_role; 43 show column_number from mo_user_grant; 44 show column_number from mo_role_grant; 45 show column_number from mo_role_privs; 46 show column_number from mo_user_defined_function; 47 show column_number from mo_tables; 48 show column_number from mo_database; 49 show column_number from mo_columns; 50 show column_number from mo_indexes; 51 show column_number from mo_table_partitions; 52 53 use system_metrics; 54 show column_number from metric; 55 show column_number from sql_statement_total; 56 show column_number from sql_statement_errors; 57 show column_number from sql_statement_cu; 58 show column_number from sql_transaction_total; 59 show column_number from sql_transaction_errors; 60 show column_number from server_connections; 61 show column_number from process_cpu_percent; 62 show column_number from process_resident_memory_bytes; 63 show column_number from process_open_fds; 64 show column_number from sys_cpu_seconds_total; 65 show column_number from sys_cpu_combined_percent; 66 show column_number from sys_memory_used; 67 show column_number from sys_memory_available; 68 show column_number from sys_disk_read_bytes; 69 show column_number from sys_disk_write_bytes; 70 show column_number from sys_net_recv_bytes; 71 show column_number from sys_net_sent_bytes; 72 73 use system; 74 show column_number from statement_info; 75 show column_number from rawlog; 76 show column_number from log_info; 77 show column_number from error_info; 78 show column_number from span_info; 79 show column_number from sql_statement_hotspot; 80 81 82 -- test max nad min values of the data in the table 83 drop database if exists test_db; 84 create database test_db; 85 86 show table_number from test_db; 87 88 use test_db; 89 90 drop table if exists t1; 91 -- test non primary key table 92 create table t1( 93 col1 int, 94 col2 float, 95 col3 varchar, 96 col4 blob, 97 col6 date, 98 col7 bool 99 ); 100 101 102 show table_number from test_db; 103 104 105 show table_values from t1; 106 select mo_table_rows("test_db","t1"),mo_table_size("test_db","t1"); 107 108 109 insert into t1 values(100,10.34,"你好",'aaa','2011-10-10',0); 110 show table_values from t1; 111 112 insert into t1 values(10,1.34,"你",'aa','2011-10-11',1); 113 show table_values from t1; 114 115 select mo_table_rows("test_db","t1"),mo_table_size("test_db","t1"); 116 117 -- test primary key table 118 drop table if exists t11; 119 create table t11( 120 col1 int primary key, 121 col2 float, 122 col3 varchar, 123 col4 blob, 124 col6 date, 125 col7 bool 126 ); 127 128 129 show table_number from test_db; 130 131 132 show table_values from t11; 133 select mo_table_rows("test_db","t11"),mo_table_size("test_db","t11"); 134 135 insert into t11 values(100,10.34,"你好",'aaa','2011-10-10',0); 136 show table_values from t11; 137 138 insert into t11 values(10,1.34,"你",'aa','2011-10-11',1); 139 show table_values from t11; 140 141 select mo_table_rows("test_db","t11"),mo_table_size("test_db","t11"); 142 143 -- test external table 144 create external table external_table( 145 col1 int, 146 col2 float, 147 col3 varchar, 148 col4 blob, 149 col6 date, 150 col7 bool 151 )infile{"filepath"='$resources/external_table_file/external_table.csv'} fields terminated by ',' enclosed by '\"' lines terminated by '\n'; 152 153 select * from external_table; 154 155 show table_number from test_db; 156 157 show table_values from external_table; 158 159 -- test partition table 160 DROP TABLE IF EXISTS partition_table; 161 create table partition_table( 162 empno int unsigned auto_increment, 163 ename varchar(15), 164 job varchar(10), 165 mgr int unsigned , 166 hiredate date, 167 sal decimal(7,2), 168 comm decimal(7,2), 169 deptno int unsigned, 170 primary key(empno, deptno) 171 ) 172 PARTITION BY KEY(deptno) 173 PARTITIONS 4; 174 175 show table_number from test_db; 176 177 show table_values from partition_table; 178 select mo_table_rows("test_db", "partition_table"),mo_table_size("test_db", "partition_table"); 179 180 INSERT INTO partition_table VALUES (7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20); 181 INSERT INTO partition_table VALUES (7499,'ALLEN','SALESMAN',7698,'1981-02-20',1600,300,30); 182 show table_values from partition_table; 183 184 INSERT INTO partition_table VALUES (7521,'WARD','SALESMAN',7698,'1981-02-22',1250,500,30); 185 INSERT INTO partition_table VALUES (7566,'JONES','MANAGER',7839,'1981-04-02',2975,NULL,20); 186 show table_values from partition_table; 187 188 select mo_table_rows("test_db", "partition_table"),mo_table_size("test_db", "partition_table"); 189 190 create table t2( 191 col1 json 192 ); 193 194 195 show table_values from t2; 196 197 insert into t2 values(); 198 show table_values from t2; 199 200 insert into t2 values(('{"x": 17}')); 201 show table_values from t2; 202 203 insert into t2 values (('{"x": [18]}')); 204 show table_values from t2; 205 206 207 create table t3( 208 col1 decimal(5,2) 209 ); 210 211 show table_values from t3; 212 213 insert into t3 values(); 214 show table_values from t3; 215 216 insert into t3 values(3.3); 217 show table_values from t3; 218 219 insert into t3 values(3.2); 220 show table_values from t3; 221 222 drop database test_db; 223 224 225 -- test common tenant system db table_number 226 drop account if exists test_account; 227 create account test_account admin_name = 'test_user' identified by '111'; 228 -- @session:id=2&user=test_account:test_user&password=111 229 230 show table_number from information_schema; 231 show table_number from mysql; 232 show table_number from mo_catalog; 233 show table_number from system_metrics; 234 show table_number from system; 235 236 use information_schema; 237 show column_number from key_column_usage; 238 show column_number from columns; 239 show column_number from profiling; 240 show column_number from processlist; 241 show column_number from schemata; 242 show column_number from character_sets; 243 show column_number from triggers; 244 show column_number from tables; 245 show column_number from engines; 246 show column_number from routines; 247 show column_number from parameters; 248 show column_number from keywords; 249 show column_number from partitions; 250 251 use mysql; 252 show column_number from user; 253 show column_number from db; 254 show column_number from procs_priv; 255 show column_number from columns_priv; 256 show column_number from tables_priv; 257 258 use mo_catalog; 259 show column_number from mo_user; 260 show column_number from mo_role; 261 show column_number from mo_user_grant; 262 show column_number from mo_role_grant; 263 show column_number from mo_role_privs; 264 show column_number from mo_user_defined_function; 265 show column_number from mo_tables; 266 show column_number from mo_database; 267 show column_number from mo_columns; 268 269 use system; 270 show column_number from statement_info; 271 272 273 -- test max nad min values of the data in the table 274 drop database if exists test_db; 275 create database test_db; 276 277 278 show table_number from test_db; 279 280 281 use test_db; 282 283 drop table if exists t1; 284 -- test non primary key table 285 create table t1( 286 col1 int, 287 col2 float, 288 col3 varchar, 289 col4 blob, 290 col6 date, 291 col7 bool 292 ); 293 294 295 show table_number from test_db; 296 297 298 show table_values from t1; 299 select mo_table_rows("test_db","t1"),mo_table_size("test_db","t1"); 300 301 302 insert into t1 values(100,10.34,"你好",'aaa','2011-10-10',0); 303 show table_values from t1; 304 305 insert into t1 values(10,1.34,"你",'aa','2011-10-11',1); 306 show table_values from t1; 307 308 select mo_table_rows("test_db","t1"),mo_table_size("test_db","t1"); 309 310 -- test primary key table 311 drop table if exists t11; 312 create table t11( 313 col1 int primary key, 314 col2 float, 315 col3 varchar, 316 col4 blob, 317 col6 date, 318 col7 bool 319 ); 320 321 322 show table_number from test_db; 323 324 325 show table_values from t11; 326 select mo_table_rows("test_db","t11"),mo_table_size("test_db","t11"); 327 328 insert into t11 values(100,10.34,"你好",'aaa','2011-10-10',0); 329 show table_values from t11; 330 331 insert into t11 values(10,1.34,"你",'aa','2011-10-11',1); 332 show table_values from t11; 333 334 select mo_table_rows("test_db","t11"),mo_table_size("test_db","t11"); 335 336 -- test external table 337 create external table external_table( 338 col1 int, 339 col2 float, 340 col3 varchar, 341 col4 blob, 342 col6 date, 343 col7 bool 344 )infile{"filepath"='$resources/external_table_file/external_table.csv'} fields terminated by ',' enclosed by '\"' lines terminated by '\n'; 345 346 select * from external_table; 347 348 show table_number from test_db; 349 350 351 show table_values from external_table; 352 353 354 create table t2( 355 col1 json 356 ); 357 358 359 show table_values from t2; 360 361 insert into t2 values(); 362 show table_values from t2; 363 364 insert into t2 values(('{"x": 17}')); 365 show table_values from t2; 366 367 insert into t2 values (('{"x": [18]}')); 368 show table_values from t2; 369 370 371 create table t3( 372 col1 decimal 373 ); 374 375 show table_values from t3; 376 377 insert into t3 values(); 378 show table_values from t3; 379 380 insert into t3 values(3.3); 381 show table_values from t3; 382 383 insert into t3 values(3.2); 384 show table_values from t3; 385 386 drop database test_db; 387 -- @session 388 389 390 drop account if exists test_account;