17. show table status Table 的各种信息,都在 tables_fields_info[] 数组里定义义 ,Name,Engine,Version,Row_format,Rows,Avg_row_lenght,Data_length 等等
18. show table status 再看 ST_SCHEMA_TABLE schema_tables[] 关于 tables 的定义 表的名字: TABLES 表结构的定义: tables_fields_info 表的创建函数: create_schema_table 填冲数据函数: by function get_all_tables and get_schema_tables_record
Mysql 的作者遍布全世界 root@(none) 01:45:16>SHOW AUTHORS; +--------------------------------+---------------------------------------+----------------------------------------------------------------------+ | Name | Location | Comment | +--------------------------------+---------------------------------------+----------------------------------------------------------------------+ | Brian (Krow) Aker | Seattle, WA, USA | Architecture, archive, federated, bunch of little stuff :) | | Venu Anuganti | | Client/server protocol (4.1) | | David Axmark | Uppsala, Sweden | Small stuff long time ago, Monty ripped it out! | | Alexander (Bar) Barkov | Izhevsk, Russia | Unicode and character sets (4.1) | | Omer BarNir | Sunnyvale, CA, USA | Testing (sometimes) and general QA stuff | | Guilhem Bichot | Bordeaux, France | Replication (since 4.0) | | John Birrell | | Emulation of pthread_mutex() for OS/2 | | Andreas F. Bobak | | AGGREGATE extension to user-defined functions | | Alexey Botchkov (Holyfoot) | Izhevsk, Russia | GIS extensions (4.1), embedded server (4.1), precision math (5.0) | | Reggie Burnett | Nashville, TN, USA | Windows development, Connectors | | Oleksandr Byelkin | Lugansk, Ukraine | Query Cache (4.0), Subqueries (4.1), Views (5.0) | | Kent Boortz | Orebro, Sweden | Test platform, and general build stuff | | Tim Bunce | | mysqlhotcopy | | Yves Carlier | | mysqlaccess | | Joshua Chamas | Cupertino, CA, USA | Concurrent insert, extended date syntax | | Petr Chardin | Moscow, Russia | Instance Manager (5.0), Server log tables (5.1) | | Wei-Jou Chen | | Chinese (Big5) character set | | Albert Chin-A-Young | | Tru64 port, large file support, better TCP wrappers support | | Jorge del Conde | Mexico City, Mexico | Windows development | | Antony T. Curtis | Norwalk, CA, USA | Parser, port to OS/2, storage engines and some random stuff | | Yuri Dario | | OS/2 port | | Andrei Elkin | Espoo, Finland | Replication | | Patrick Galbraith | Sharon, NH | Federated Engine, mysqlslap | | Sergei Golubchik | Kerpen, Germany | Full-text search, precision math | | Lenz Grimmer | Hamburg, Germany | Production (build and release) engineering | | Nikolay Grishakin | Austin, TX, USA | Testing - Server | | Wei He | | Chinese (GBK) character set | | Eric Herman | Amsterdam, Netherlands | Bug fixing - federated | | Andrey Hristov | Walldorf, Germany | Event scheduler (5.1) | | Alexander (Alexi) Ivanov | St. Petersburg, Russia | Replication | | Alexander (Salle) Keremidarski | Sofia, Bulgaria | Bug fixing | | Mats Kindahl | Storvreta, Sweden | Replication | | Serge Kozlov | Velikie Luki, Russia | Testing - Cluster | | Hakan Kü?üky?lmaz | Walldorf, Germany | Testing - Server | | Greg (Groggy) Lehey | Uchunga, SA, Australia | Backup | | Matthias Leich | Berlin, Germany | Testing - Server | | Dmitri Lenev | Moscow, Russia | Time zones support (4.1), Triggers (5.0) | | Arjen Lentz | Brisbane, Australia | Documentation (2001-2004), Dutch error messages, LOG2() | | Marc Liyanage | | Created Mac OS X packages | | Zarko Mocnik | | Sorting for Slovenian language | | Per-Erik Martin | Uppsala, Sweden | Stored Procedures (5.0) | | Alexis Mikhailov | | User-defined functions | | Sinisa Milivojevic | Larnaca, Cyprus | UNION (4.0), Subqueries in FROM clause (4.1), many other features | | Jonathan (Jeb) Miller | Kyle, TX, USA | Testing - Cluster, Replication | | Elliot Murphy | Cocoa, FL, USA | Replication and backup | | Kristian Nielsen | Copenhagen, Denmark | General build stuff | | Pekka Nouisiainen | Stockholm, Sweden | NDB Cluster: BLOB support, character set support, ordered indexes | | Alexander Nozdrin | Moscow, Russia | Bug fixing (Stored Procedures, 5.0) | | Per Eric Olsson | | Testing of dynamic record format | | Jonas Oreland | Stockholm, Sweden | NDB Cluster, Online Backup, lots of other things | | Konstantin Osipov | Moscow, Russia | Prepared statements (4.1), Cursors (5.0) | | Alexander (Sasha) Pachev | Provo, UT, USA | Statement-based replication, SHOW CREATE TABLE, mysql-bench | | Irena Pancirov | | Port to Windows with Borland compiler | | Jan Pazdziora | | Czech sorting order | | Benjamin Pflugmann | | Extended MERGE storage engine to handle INSERT | | Igor Romanenko | | mysqldump | | Mikael Ronstr?m | Stockholm, Sweden | NDB Cluster, Partitioning (5.1), Optimizations | | T?nu Samuel | | VIO interface, other miscellaneous features | | Carsten Segieth (Pino) | Fredersdorf, Germany | Testing - Server | | Martin Sk?ld | Stockholm, Sweden | NDB Cluster: Unique indexes, integration into MySQL | | Timothy Smith | Auckland, New Zealand | Dynamic character sets, parts of the build system, libmysqld | | Miguel Solorzano | Florianopolis, Santa Catarina, Brazil | Windows development, Windows NT service | | Punita Srivastava | Austin, TX, USA | Testing - Merlin | | Alexey Stroganov (Ranger) | Lugansk, Ukraine | Testing - Benchmarks | | Ingo Strüwing | Berlin, Germany | Bug fixing | | Magnus Svensson | ?regrund, Sweden | NDB Cluster: Integration into MySQL, test framework | | Zeev Suraski | | FROM_UNIXTIME(), ENCRYPT() | | TAMITO | | The _MB character set macros and UJIS and SJIS character sets | | Jani Tolonen | Helsinki, Finland | mysqlimport, extensions to command-line clients, PROCEDURE ANALYSE() | | Lars Thalmann | Stockholm, Sweden | Replication and cluster development | | Tomas Ulin | Stockholm, Sweden | NDB Cluster: Configuration, installation | | Gianmassimo Vigazzola | | Initial Windows port | | Sergey Vojtovich | Izhevsk, Russia | Plugins infrastructure (5.1) | | Matt Wagner | Northfield, MN, USA | Bug fixing | | Jim Winstead Jr. | Los Angeles, CA, USA | Bug fixing | | Michael (Monty) Widenius | Tusby, Finland | Lead developer and main author | | Peter Zaitsev | Tacoma, WA, USA | SHA1(), AES_ENCRYPT(), AES_DECRYPT(), bug fixing | +--------------------------------+---------------------------------------+----------------------------------------------------------------------+
root@(none) 01:45:40>show contributors; +-------------------+---------------------+-------------------------------------+ | Name | Location | Comment | +-------------------+---------------------+-------------------------------------+ | Ronald Bradford | Brisbane, Australia | EFF contribution for UC2006 Auction | | Sheeri Kritzer | Boston, Mass. USA | EFF contribution for UC2006 Auction | | Mark Shuttleworth | London, UK. | EFF contribution for UC2006 Auction | +-------------------+---------------------+-------------------------------------+ 3 rows in set (0.01 sec)
root@test 03:11:33>show create database test; +----------+--------------------------------------------------------------+ | Database | Create Database | +----------+--------------------------------------------------------------+ | test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET gbk */ | +----------+--------------------------------------------------------------+ 1 row in set (0.00 sec)
root@test 03:26:59>show privileges; +-------------------------+---------------------------------------+-------------------------------------------------------+ | Privilege | Context | Comment | +-------------------------+---------------------------------------+-------------------------------------------------------+ | Alter | Tables | To alter the table | | Alter routine | Functions,Procedures | To alter or drop stored functions/procedures | | Create | Databases,Tables,Indexes | To create new databases and tables | | Create routine | Databases | To use CREATE FUNCTION/PROCEDURE | | Create temporary tables | Databases | To use CREATE TEMPORARY TABLE | | Create view | Tables | To create new views | | Create user | Server Admin | To create new users | | Delete | Tables | To delete existing rows | | Drop | Databases,Tables | To drop databases, tables, and views | | Event | Server Admin | To create, alter, drop and execute events | | Execute | Functions,Procedures | To execute stored routines | | File | File access on server | To read and write files on the server | | Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess | | Index | Tables | To create or drop indexes | | Insert | Tables | To insert data into tables | | Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) | | Process | Server Admin | To view the plain text of currently executing queries | | References | Databases,Tables | To have references on tables | | Reload | Server Admin | To reload or refresh tables, logs and privileges | | Replication client | Server Admin | To ask where the slave or master servers are | | Replication slave | Server Admin | To read binary log events from the master | | Select | Tables | To retrieve rows from table | | Show databases | Server Admin | To see all databases with SHOW DATABASES | | Show view | Tables | To see views with SHOW CREATE VIEW | | Shutdown | Server Admin | To shut down the server | | Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. | | Trigger | Tables | To use triggers | | Update | Tables | To update existing rows | | Usage | Server Admin | No privileges - allow connect only | +-------------------------+---------------------------------------+-------------------------------------------------------+
sql/Table.h /* Make sure that the order of schema_tables and enum_schema_tables are the same. */ enum enum_schema_tables { SCH_CHARSETS= 0, SCH_COLLATIONS, SCH_COLLATION_CHARACTER_SET_APPLICABILITY, SCH_COLUMNS, SCH_COLUMN_PRIVILEGES, SCH_ENGINES, SCH_EVENTS, SCH_FILES, SCH_GLOBAL_STATUS, SCH_GLOBAL_VARIABLES, SCH_KEY_COLUMN_USAGE, SCH_OPEN_TABLES, SCH_PARTITIONS, SCH_PLUGINS, SCH_PROCESSLIST, SCH_PROFILES, SCH_REFERENTIAL_CONSTRAINTS, SCH_PROCEDURES, SCH_SCHEMATA, SCH_SCHEMA_PRIVILEGES, SCH_SESSION_STATUS, SCH_SESSION_VARIABLES, SCH_STATISTICS, SCH_STATUS, SCH_TABLES, SCH_TABLE_CONSTRAINTS, SCH_TABLE_NAMES, SCH_TABLE_PRIVILEGES, SCH_TRIGGERS, SCH_USER_PRIVILEGES, SCH_VARIABLES, SCH_VIEWS }; 参考: http://forge.mysql.com/wiki/INFORMATION_SCHEMA_storage_engine
如何把一台 mysql 做成多台 master 的 slave?
各个版本的 mysql 所展示的 show innodb status 会有差异 5.1.45-log Source distribution Innodb plugin
/*********************************************************************//** Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ UNIV_INTERN void dict_update_statistics_low( /*=======================*/ dict_table_t* table, /*!< in/out: table */ ibool has_dict_mutex __attribute__((unused))) /*!< in: TRUE if the caller has the dictionary mutex */ { dict_index_t* index; ulint size; ulint sum_of_index_sizes = 0; if (table->ibd_file_missing) { ut_print_timestamp(stderr); fprintf(stderr, &quot; InnoDB: cannot calculate statistics for table %s
&quot; &quot;InnoDB: because the .ibd file is missing. For help,&quot; &quot; please refer to
&quot; &quot;InnoDB: &quot; REFMAN &quot;innodb-troubleshooting.html
&quot;, table->name); return; } /* If we have set a high innodb_force_recovery level, do not calculate statistics, as a badly corrupted index can cause a crash in it. */ if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { return; } /* Find out the sizes of the indexes and how many different values for the key they approximately have */ // 先查找第一个索引,至少有一个索引 index = dict_table_get_first_index(table); if (index == NULL) { /* Table definition is corrupt */ return; } while (index) { // 取得当前索引大小精确值 size = btr_get_size(index, BTR_TOTAL_SIZE); index->stat_index_size = size; sum_of_index_sizes += size; // 取得当前索引叶子结点页数 size = btr_get_size(index, BTR_N_LEAF_PAGES); if (size == 0) { /* The root node of the tree is a leaf */ size = 1; } index->stat_n_leaf_pages = size; // 预测不同的索引键值个数 btr_estimate_number_of_different_key_vals(index); // 查找下一个索引 index = dict_table_get_next_index(index); } // 第一个索引,总是 cluster_index, 怪不得其它索引称为第二索引 index = dict_table_get_first_index(table); dict_index_stat_mutex_enter(index); // 表的行数,从索引的统计数据里获取 table->stat_n_rows = index->stat_n_diff_key_vals[ dict_index_get_n_unique(index)]; dict_index_stat_mutex_exit(index); // 主索引大小 cluster index table->stat_clustered_index_size = index->stat_index_size; // 其它索引总共大小 = 索引总大小 -cluster_index_size table->stat_sum_of_other_index_sizes = sum_of_index_sizes - index->stat_index_size; table->stat_initialized = TRUE; table->stat_modified_counter = 0; }