Rechercher dans le manuel MySQL
14.7 Data Dictionary Usage Differences
Use of a data dictionary-enabled MySQL server entails some operational differences compared to a server that does not have a data dictionary:
Previously, enabling the
innodb_read_onlysystem variable prevented creating and dropping tables only for theInnoDBstorage. As of MySQL 8.0, enablinginnodb_read_onlyprevents these operations for all storage engines. Table creation and drop operations for any storage engine modify data dictionary tables in themysqlsystem database, but those tables use theInnoDBstorage engine and cannot be modified wheninnodb_read_onlyis enabled. The same principle applies to other table operations that require modifying data dictionary tables. Examples:ANALYZE TABLEfails because it updates table statistics, which are stored in the data dictionary.ALTER TABLEfails because it updates the storage engine designation, which is stored in the data dictionary.tbl_nameENGINE=engine_name
NoteEnabling
innodb_read_onlyalso has important implications for non-data dictionary tables in themysqlsystem database. For details, see the description ofinnodb_read_onlyin Section 15.13, “InnoDB Startup Options and System Variables”Previously, tables in the
mysqlsystem database were visible to DML and DDL statements. As of MySQL 8.0, data dictionary tables are invisible and cannot be modified or queried directly. However, in most cases there are correspondingINFORMATION_SCHEMAtables that can be queried instead. This enables the underlying data dictionary tables to be changed as server development proceeds, while maintaining a stableINFORMATION_SCHEMAinterface for application use.INFORMATION_SCHEMAtables in MySQL 8.0 are closely tied to the data dictionary, resulting in several usage differences:Previously,
INFORMATION_SCHEMAqueries for table statistics in theSTATISTICSandTABLEStables retrieved statistics directly from storage engines. As of MySQL 8.0, cached table statistics are used by default. Theinformation_schema_stats_expirysystem variable defines the period of time before cached table statistics expire. The default is 86400 seconds (24 hours). (To update the cached values at any time for a given table, useANALYZE TABLE.) If there are no cached statistics or statistics have expired, statistics are retrieved from storage engines when querying table statistics columns. To always retrieve the latest statistics directly from storage engines, setinformation_schema_stats_expiryto0. For more information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.Several
INFORMATION_SCHEMAtables are views on data dictionary tables, which enables the optimizer to use indexes on those underlying tables. Consequently, depending on optimizer choices, the row order of results forINFORMATION_SCHEMAqueries might differ from previous results. If a query result must have specific row ordering characteristics, include anORDER BYclause.Queries on
INFORMATION_SCHEMAtables may return column names in a different lettercase than in earlier MySQL series. Applications should test result set column names in case-insensitive fashion. If that is not feasible, a workaround is to use column aliases in the select list that return column names in the required lettercase. For example:mysqldump and mysqlpump no longer dump the
INFORMATION_SCHEMAdatabase, even if explicitly named on the command line.CREATE TABLErequires thatdst_tblLIKEsrc_tblsrc_tblbe a base table and fails if it is anINFORMATION_SCHEMAtable that is a view on data dictionary tables.Previously, result set headers of columns selected from
INFORMATION_SCHEMAtables used the capitalization specified in the query. This query produces a result set with a header oftable_name:As of MySQL 8.0, these headers are capitalized; the preceding query produces a result set with a header of
TABLE_NAME. If necessary, a column alias can be used to achieve a different lettercase. For example:
The data directory affects how mysqldump and mysqlpump dump information from the
mysqlsystem database:Previously, it was possible to dump all tables in the
mysqlsystem database. As of MySQL 8.0, mysqldump and mysqlpump dump only non-data dictionary tables in that database.Previously, the
--routinesand--eventsoptions were not required to include stored routines and events when using the--all-databasesoption: The dump included themysqlsystem database, and therefore also theprocandeventtables containing stored routine and event definitions. As of MySQL 8.0, theeventandproctables are not used. Definitions for the corresponding objects are stored in data dictionary tables, but those tables are not dumped. To include stored routines and events in a dump made using--all-databases, use the--routinesand--eventsoptions explicitly.Previously, the
--routinesoption required theSELECTprivilege for theproctable. As of MySQL 8.0, that table is not used;--routinesrequires the globalSELECTprivilege instead.Previously, it was possible to dump stored routine and event definitions together with their creation and modification timestamps, by dumping the
procandeventtables. As of MySQL 8.0, those tables are not used, so it is not possible to dump timestamps.
Previously, creating a stored routine that contains illegal characters produced a warning. As of MySQL 8.0, this is an error.
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-data-dictionary-usage-differences.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.