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