Related to this bug I was dreaming: We live in a relational world. So everything should be a table...
Instead of writing those information to the error log (which does not even happen because of the bug) I would like to have written them in a table.
CHECK TABLE imho is anway the wrong command. I would prefer the ANALZYE TABLE command instead (but this is a detail).
So what I would like to have is:
ANALYZE TABLE foodmart.product;
and then:
SELECT * from pbxt.table_statistics; +---------------+--------------+------------+--------------------+----------------------------+-------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+----------------+-------------------+----------------+-------------------+--------------------+-------------------+-------------------------+----------------------------+----------------------------------+----------------------------+------------------------+-------------------+----------------------+-----------------------+---------------------------+---------------------------+---------------------------+-------------------+----------------------+------------------------+ | Table_catalog | Table_schema | Table_name | Record_buffer_size | Fixed_length_record_length | Handle_data_record_size | Min_header_size | Max_header_size | Min_record_size | Avg_record_size | Max_record_size | Avg_row_length | Rows_fixed_length | Max_fixed size | Min_variable size | Min_auto_increment | Number_of_columns | Number_of_fixed_columns | Columns_required_for_index | Record_length_required_for_index | Columns_required_for_blobs | Number_of_blob_columns | Number_of_indices | Extended_data_length | Extended_record_count | Min_compare_record_length | Avg_compare_record_length | Max_compare_record_length | Free_record_count | Deleted_record_count | Allocated_record_count | +---------------+--------------+------------+--------------------+----------------------------+-------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+----------------+-------------------+----------------+-------------------+--------------------+-------------------+-------------------------+----------------------------+----------------------------------+----------------------------+------------------------+-------------------+----------------------+-----------------------+---------------------------+---------------------------+---------------------------+-------------------+----------------------+------------------------+ | NULL | foodmart | product | 192 | 191 | 205 | 14 | 14 | 82 | 202 | 202 | NULL | YES | 16384 | 320 | 0 | 15 | 0 | 5 | 140 | 0 | 0 | 5 | NULL | NULL | 93 | 112 | 138 | 0 | 0 | 1560 | | NULL | foodmart | product2 | 192 | 191 | 74 | 14 | 26 | 82 | 202 | 202 | 60 | NO | 65536 | 320 | 0 | 15 | 8 | 15 | 202 | 0 | 0 | 5 | 65008 | 1560 | 86 | 90 | 90 | 0 | 0 | 1560 | +---------------+--------------+------------+--------------------+----------------------------+-------------------------+-----------------+-----------------+-----------------+-----------------+-----------------+----------------+-------------------+----------------+-------------------+--------------------+-------------------+-------------------------+----------------------------+----------------------------------+----------------------------+------------------------+-------------------+----------------------+-----------------------+---------------------------+---------------------------+---------------------------+-------------------+----------------------+------------------------+
CREATE TEMPORARY TABLE pbxt.table_statistics ( `Table_catalog` varchar(512) DEFAULT NULL, `Table_schema` varchar(64) NOT NULL DEFAULT '', `Table_name` varchar(64) NOT NULL DEFAULT '', `Record_buffer_size` int unsigned NOT NULL DEFAULT 0, `Fixed_length_record_length` int unsigned NOT NULL DEFAULT 0, # why length and not size? `Handle_data_record_size` int unsigned NOT NULL DEFAULT 0, `Min_header_size` int unsigned NOT NULL DEFAULT 0, `Max_header_size` int unsigned NOT NULL DEFAULT 0, `Min_record_size` bigint unsigned NOT NULL DEFAULT 0, `Avg_record_size` bigint unsigned NOT NULL DEFAULT 0, `Max_record_size` bigint unsigned NOT NULL DEFAULT 0, `Avg_row_length` int unsigned NULL DEFAULT NULL, `Rows_fixed_length` char(3) NOT NULL DEFAULT 'YES', `Max_fixed size` int unsigned NOT NULL DEFAULT 0, `Min_variable size` int unsigned NOT NULL DEFAULT 0, `Min_auto_increment` bigint unsigned NOT NULL DEFAULT 0, `Number_of_columns` int unsigned NOT NULL DEFAULT 0, `Number_of_fixed_columns` int unsigned NOT NULL DEFAULT 0, `Columns_required_for_index` int unsigned NOT NULL DEFAULT 0, `Record_length_required_for_index` bigint unsigned NOT NULL DEFAULT 0, `Columns_required_for_blobs` int unsigned NOT NULL DEFAULT 0, `Number_of_blob_columns` int unsigned NOT NULL DEFAULT 0, `Number_of_indices` int unsigned NOT NULL DEFAULT 0, `Extended_data_length` bigint unsigned NULL DEFAULT NULL, `Extended_record_count` bigint unsigned NULL DEFAULT NULL, `Min_compare_record_length` bigint unsigned NOT NULL DEFAULT 0, `Avg_compare_record_length` bigint unsigned NOT NULL DEFAULT 0, `Max_compare_record_length` bigint unsigned NOT NULL DEFAULT 0, `Free_record_count` bigint unsigned NOT NULL DEFAULT 0, `Deleted_record_count` bigint unsigned NOT NULL DEFAULT 0, `Allocated_record_count` bigint unsigned NOT NULL DEFAULT 0 ) ENGINE=PBXT DEFAULT CHARSET=utf8
insert into pbxt.table_statistics values ( NULL, 'foodmart', 'product', 192, 191, 205, 14, 14, 82, 202, 202, NULL, 'YES', 16384, 320, 0, 15, 0, 5, 140, 0, 0, 5, null, null, 93, 112, 138, 0, 0, 1560) , ( NULL, 'foodmart', 'product2', 192, 191, 74, 14, 26, 82, 202, 202, 60, 'NO', 65536, 320, 0, 15, 8, 15, 202, 0, 0, 5, 65008, 1560, 86, 90, 90, 0, 0, 1560) ;
This is a much better way imho when you want to do some reports and automatized analytics about your tables for performance tuning etc.
Related to this bug I was dreaming: We live in a relational world. So everything should be a table...
Instead of writing those information to the error log (which does not even happen because of the bug) I would like to have written them in a table.
CHECK TABLE imho is anway the wrong command. I would prefer the ANALZYE TABLE command instead (but this is a detail).
So what I would like to have is:
ANALYZE TABLE foodmart.product;
and then:
SELECT * from pbxt.table_ statistics; ------- --+---- ------- ---+--- ------- --+---- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- -+----- ------- -----+- ------- ------- --+---- ------- ------+ ------- ------- ---+--- ------- ------- +------ ------- ---+--- ------- ------- --+---- ------- -----+- ------- ------- ----+-- ------- ------- ----+-- ------- ------- ---+--- ------- ------- ------- -+----- ------- ------- ------- --+---- ------- ------- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- +------ ------- ------+ ------- ------- ------- -+----- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ---+--- ------- ------- -----+- ------- ------- ------- --+ record_ length | Handle_ data_record_ size | Min_header_size | Max_header_size | Min_record_size | Avg_record_size | Max_record_size | Avg_row_length | Rows_fixed_length | Max_fixed size | Min_variable size | Min_auto_increment | Number_of_columns | Number_ of_fixed_ columns | Columns_ required_ for_index | Record_ length_ required_ for_index | Columns_ required_ for_blobs | Number_ of_blob_ columns | Number_of_indices | Extended_ data_length | Extended_ record_ count | Min_compare_ record_ length | Avg_compare_ record_ length | Max_compare_ record_ length | Free_record_count | Deleted_ record_ count | Allocated_ record_ count | ------- --+---- ------- ---+--- ------- --+---- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- -+----- ------- -----+- ------- ------- --+---- ------- ------+ ------- ------- ---+--- ------- ------- +------ ------- ---+--- ------- ------- --+---- ------- -----+- ------- ------- ----+-- ------- ------- ----+-- ------- ------- ---+--- ------- ------- ------- -+----- ------- ------- ------- --+---- ------- ------- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- +------ ------- ------+ ------- ------- ------- -+----- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ---+--- ------- ------- -----+- ------- ------- ------- --+ ------- --+---- ------- ---+--- ------- --+---- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- -+----- ------- -----+- ------- ------- --+---- ------- ------+ ------- ------- ---+--- ------- ------- +------ ------- ---+--- ------- ------- --+---- ------- -----+- ------- ------- ----+-- ------- ------- ----+-- ------- ------- ---+--- ------- ------- ------- -+----- ------- ------- ------- --+---- ------- ------- ------- ------- --+---- ------- ------- ------- ---+--- ------- ------- ------- +------ ------- ------+ ------- ------- ------- -+----- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ------- ----+-- ------- ------- ---+--- ------- ------- -----+- ------- ------- ------- --+
+------
| Table_catalog | Table_schema | Table_name | Record_buffer_size | Fixed_length_
+------
| NULL | foodmart | product | 192 | 191 | 205 | 14 | 14 | 82 | 202 | 202 | NULL | YES | 16384 | 320 | 0 | 15 | 0 | 5 | 140 | 0 | 0 | 5 | NULL | NULL | 93 | 112 | 138 | 0 | 0 | 1560 |
| NULL | foodmart | product2 | 192 | 191 | 74 | 14 | 26 | 82 | 202 | 202 | 60 | NO | 65536 | 320 | 0 | 15 | 8 | 15 | 202 | 0 | 0 | 5 | 65008 | 1560 | 86 | 90 | 90 | 0 | 0 | 1560 |
+------
CREATE TEMPORARY TABLE pbxt.table_ statistics ( buffer_ size` int unsigned NOT NULL DEFAULT 0, length_ record_ length` int unsigned NOT NULL DEFAULT 0, # why length and not size? data_record_ size` int unsigned NOT NULL DEFAULT 0, fixed_length` char(3) NOT NULL DEFAULT 'YES', auto_increment` bigint unsigned NOT NULL DEFAULT 0, of_columns` int unsigned NOT NULL DEFAULT 0, of_fixed_ columns` int unsigned NOT NULL DEFAULT 0, required_ for_index` int unsigned NOT NULL DEFAULT 0, length_ required_ for_index` bigint unsigned NOT NULL DEFAULT 0, required_ for_blobs` int unsigned NOT NULL DEFAULT 0, of_blob_ columns` int unsigned NOT NULL DEFAULT 0, of_indices` int unsigned NOT NULL DEFAULT 0, data_length` bigint unsigned NULL DEFAULT NULL, record_ count` bigint unsigned NULL DEFAULT NULL, compare_ record_ length` bigint unsigned NOT NULL DEFAULT 0, compare_ record_ length` bigint unsigned NOT NULL DEFAULT 0, compare_ record_ length` bigint unsigned NOT NULL DEFAULT 0, record_ count` bigint unsigned NOT NULL DEFAULT 0, record_ count` bigint unsigned NOT NULL DEFAULT 0, record_ count` bigint unsigned NOT NULL DEFAULT 0
`Table_catalog` varchar(512) DEFAULT NULL,
`Table_schema` varchar(64) NOT NULL DEFAULT '',
`Table_name` varchar(64) NOT NULL DEFAULT '',
`Record_
`Fixed_
`Handle_
`Min_header_size` int unsigned NOT NULL DEFAULT 0,
`Max_header_size` int unsigned NOT NULL DEFAULT 0,
`Min_record_size` bigint unsigned NOT NULL DEFAULT 0,
`Avg_record_size` bigint unsigned NOT NULL DEFAULT 0,
`Max_record_size` bigint unsigned NOT NULL DEFAULT 0,
`Avg_row_length` int unsigned NULL DEFAULT NULL,
`Rows_
`Max_fixed size` int unsigned NOT NULL DEFAULT 0,
`Min_variable size` int unsigned NOT NULL DEFAULT 0,
`Min_
`Number_
`Number_
`Columns_
`Record_
`Columns_
`Number_
`Number_
`Extended_
`Extended_
`Min_
`Avg_
`Max_
`Free_
`Deleted_
`Allocated_
) ENGINE=PBXT DEFAULT CHARSET=utf8
insert into pbxt.table_ statistics values
( NULL, 'foodmart', 'product', 192, 191, 205, 14, 14, 82, 202, 202, NULL, 'YES', 16384, 320, 0, 15, 0, 5, 140, 0, 0, 5, null, null, 93, 112, 138, 0, 0, 1560)
, ( NULL, 'foodmart', 'product2', 192, 191, 74, 14, 26, 82, 202, 202, 60, 'NO', 65536, 320, 0, 15, 8, 15, 202, 0, 0, 5, 65008, 1560, 86, 90, 90, 0, 0, 1560)
;
This is a much better way imho when you want to do some reports and automatized analytics about your tables for performance tuning etc.