[MySQL]InnoDB逻辑存储结构_MySQL
bitsCN.com
[MySQL]InnoDB逻辑存储结构
InnoDB存储引擎中的表非常像Oracle中的索引组织表,每张表必须得有主键,如果表在创建时没有显示定义主键,则根据以下原则自动创建主键:
1)如果有非空的唯一索引,则该索引所在的列为主键;
2)如果不符合上述条件,自动创建一个6个字节的指针为主键。
InnoDB存储引擎的逻辑存储结构和Oracle几乎一样,从大到小分别为:表空间、段、区、页,它们的关系如下图所示:
表空间
在上一篇《MySQL InnoDB文件介绍》http://www.bitsCN.com/database/201306/219327.html中,我们知道InnoDB有一个默认的表空间,如果我们启用了参数innodb_file_per_table,则针对每张可以单独放在表空间里。这里需要注意的是,即时启用了innodb_file_per_table,也并不是表中所有的数据都单独放在自己的表空间里,单独表空间只存放数据、索引和插入缓冲,其它如Undo、系统事务信息、二次写缓冲等还是存放在默认共享表空间里。
段
表空间有若干各段组成,常见的有数据段、索引段、回滚段等。前面提到InnoDB中的表是索引组织表,因此数据段也称为leaf node segment,索引段也称为non-leaf node segment。
区
每64个连续的页组成区,因此区大小正好为1M。
页
页是InnoDB磁盘管理的最小单位,固定大小为16K,不可以更改(也许通过更改源码可以修改固定大小)。
行
InnoDB表中数据按行存储。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



To query the Oracle tablespace size, follow the following steps: Determine the tablespace name by running the query: SELECT tablespace_name FROM dba_tablespaces; Query the tablespace size by running the query: SELECT sum(bytes) AS total_size, sum(bytes_free) AS available_space, sum(bytes) - sum(bytes_free) AS used_space FROM dba_data_files WHERE tablespace_

There are three ways to view instance names in Oracle: use the "sqlplus" and "select instance_name from v$instance;" commands on the command line. Use the "show instance_name;" command in SQL*Plus. Check environment variables (ORACLE_SID on Linux) through the operating system's Task Manager, Oracle Enterprise Manager, or through the operating system.

Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

To create a user in Oracle, follow these steps: Create a new user using the CREATE USER statement. Grant the necessary permissions using the GRANT statement. Optional: Use the RESOURCE statement to set the quota. Configure other options such as default roles and temporary tablespaces.
