PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
TheINNODB_VIRTUAL table provides metadata aboutInnoDBvirtual generated columns and columns upon which virtual generated columns are based.
A row appears in theINNODB_VIRTUAL table for each column upon which a virtual generated column is based.
TheINNODB_VIRTUAL table has these columns:
TABLE_IDAn identifier representing the table associated with the virtual column; the same value as
INNODB_TABLES.TABLE_ID.POSThe position value of thevirtual generated column. The value is large because it encodes the column sequence number and ordinal position. The formula used to calculate the value uses a bitwise operation:
((nth virtual generated column for the InnoDB instance + 1) << 16)+ the ordinal position of the virtual generated columnFor example, if the first virtual generated column in the
InnoDBinstance is the third column of the table, the formula is(0 + 1) << 16) + 2. The first virtual generated column in theInnoDBinstance is always number 0. As the third column in the table, the ordinal position of the virtual generated column is 2. Ordinal positions are counted from 0.BASE_POSThe ordinal position of the columns upon which a virtual generated column is based.
Example
mysql> CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (a+b) VIRTUAL, `h` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_VIRTUAL WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE "test/t1");+----------+-------+----------+| TABLE_ID | POS | BASE_POS |+----------+-------+----------+| 98 | 65538 | 0 || 98 | 65538 | 1 |+----------+-------+----------+Notes
If a constant value is assigned to avirtual generated column, as in the following table, an entry for the column does not appear in the
INNODB_VIRTUALtable. For an entry to appear, a virtual generated column must have a base column.CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS (5) VIRTUAL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;However, metadata for such a column does appear in the
INNODB_COLUMNStable.You must have the
PROCESSprivilege to query this table.Use the
INFORMATION_SCHEMACOLUMNStable or theSHOW COLUMNSstatement to view additional information about the columns of this table, including data types and default values.
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0