oracle -- data block (data Block)

Basic relationship: database---tablespace---data segment---partition---data


block (data Block)
First, the data block Block is the smallest unit in which Oracle stores data information. This is the smallest unit in the Oracle environment. Oracle also uses data blocks to shield the differences in the storage structure of different operating systems. Whether it is a Windows environment or a Unix/Linux environment, their operating system storage structure and way, and even the way of character arrangement are different. Oracle uses data blocks to shield these differences, and all data operations use operations on Oracle blocks, which is equivalent to a level of abstraction.

Second, all of Oracle's data operations and space allocation are actually operations for data blocks. We search for a row from the data table. In fact, Oracle will read the data block where the row is located from the memory buffer (or hard disk), and then return the specified data row on this data block. Whether Oracle is in the buffer or in the hard disk, the small unit of data operation is the data block.

3. The data block has a size. When a database is established, it is set by parameters. Note that in the Oracle database parameters, only the data block size parameter cannot be modified after the database is created. The size of the data block can support more than one in a database, but it is generally not meaningful and will bring a certain burden to management and debugging.

Fourth, the size of the data block (data block) is an integer multiple of the data block of the operating system. ORACLE defaults to 8K, as well as 4K, 16K, and 32K. Setting the size of the data block is based on different types of systems. If the data block setting is relatively large, more data rows will be read at one time, correspondingly, the SGA memory consumption will be relatively large, and there may be more swap-in and swap-out caused by specific queries. If the setting is too small, frequent IO logical and physical reads will also cause performance problems.
----- The relevant parameter is db_block_size, check the block size.
SQL> show parameter db_block_size;
NAME TYPE VALUE
------------------------------------ ----- ------ ------------------------------
db_block_size integer 8192 //1024×8
Note:
1. DB_BLOCK_SIZE as The minimum operation unit of the database is specified when the database is created, and cannot be modified after the database is created. To modify DB_BLOCK_SIZE, the database needs to be rebuilt. Generally, you can EXP the data, then rebuild the database, specify a new DB_BLOCK_SIZE, and then IMP the data into the database.
2. DB_BLOCK_SIZE is generally set to a multiple of the operating system block, that is, 2K, 4K, 8K, 16K or 32K, but its size is generally affected by the use of the database. For online transactions, the feature is that the transaction volume is large, but the amount of data processed by each transaction is small, so it is enough to set DB_BLOCK_SIZE to a small point, generally 4K or 8K, if the setting is too large, some of the data read at one time is useless. , which will slow down the read and write time of the database and increase unnecessary IO operations. For data warehouse and ERP applications, the amount of data processed by each transaction is very large, so DB_BLOCK_SIZE is generally set to be relatively large, generally 8K, 16K or 32K. If DB_BLOCK_SIZE is small, then I/O will naturally be more. , consumes too much.
3. A larger DB_BLOCK_SIZE can improve the performance of the index to a certain extent. Because DB_BLOCK_SIZE is relatively large, a DB_BLOCK can index more rows at a time.
4. If the row is relatively large, for example, a DB_BLOCK cannot hold a row, the database needs to perform row linking when reading data, which affects the reading performance. At this time, if the DB_BLOCK_SIZE is larger, this situation can be avoided.

 

The initialization parameter db_file_multiblock_read_count is used to constrain Oracle's behavior when reading multiple data blocks. The so-called multi-block reading means that Oracle can read multiple data blocks during one I/O, so as to complete with the smallest I/O. data read.
The setting of db_file_multiblock_read_count is affected by the maximum IO capability of the OS, that is to say, if the hardware IO capability of your system is limited, even setting a larger db_file_multiblock_read_count is useless.
------Initialize the parameter db_file_multiblock_read_count to check the reading of data completed by one I/O.
SQL> show parameter db_file_multiblock_read_count;
NAME TYPE VALUE
----------------------------------------- --------------
db_file_multiblock_read_count integer 32
 
SQL> alter session set db_file_multiblock_read_count=256;
Session changed.

SQL> show parameter db_file;
NAME TYPE VALUE
-----------------------------------------------------
db_file_multiblock_read_count        integer      128


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325069352&siteId=291194637