Table of Contents
chunk
共享池中的 heap 堆和extent 区
Home Database Mysql Tutorial sharedpool之一:heap/extent/chunk

sharedpool之一:heap/extent/chunk

Jun 07, 2016 pm 03:23 PM
heap

介绍shared pool物理结构的heap 堆,extent 区,chunk 内存中:共享池、大池、PGA是heap管理 chunk shared pool物理层面上由许多内存块组成,这些内在块称为chunk,chunk是shared pool中内存分配最小单位-类似extent,但是chunk是大小不一的,在内存中一个chunk

介绍shared pool物理结构的heap 堆,extent 区,chunk
\
内存中:共享池、大池、PGA是heap管理

chunk

shared pool物理层面上由许多内存块组成,这些内在块称为chunk,chunk是shared pool中内存分配最小单位-类似extent,但是chunk是大小不一的,在内存中一个chunk是连续的。
chunk属于可用类型的时候,既不属于library cache,也不属于dictionary cache,
如果chunk被用于存放SQL相关的数据时,则该chunk就属于library cache;
如果该chunk被用于存放数据字典的信息时,则该chunk就是属于dictionary
Chunk可以分为4类-或者叫4种状态:
1.free:chunk中没有有效的对象,可以不受限制的分配
2.recr:recreatable,--可重用的,chunk里面包含的对象可以被临时性的移 走,如果需要,可以重建,例如共享SQL语句
3.freeabl:--可释放的,session用过这个chunk,里面存放的对象数据是session 在处理过程中产生的,没有办法重建,这点不同于recr。因此这个chunk不能被临时性的移走。但是在合适的时间段可以被释放。
4.perm:permanent,--永久的SGA的固定对象等,chunk中包含永久性的对象,但是大型的permanent类型的chunk中可能包含可用空间,需要的时候,这些空间可以被释放。
查看Chunk的4种状态:--R-freea这种R开头的是在Reserved Area(保留区)中的chunk
SYS@ bys3>select distinct(ksmchcls) from x$ksmsp;
KSMCHCLS
--------
freeabl
recr
perm
R-freea
R-free
R-perm
free
R-recr
查询各种状态chunk的大小,chunk的平均大小
SYS@ bys3>select KSMCHCLS,count(*) ,round(sum( KSMCHSIZ/1024/1024),0) MB,round(avg(KSMCHSIZ),0) from x$ksmsp group by KSMCHCLS order by 1;
KSMCHCLS COUNT(*) MB ROUND(AVG(KSMCHSIZ),0)
-------- ---------- ---------- ----------------------
R-free 43 6 152374
R-freea 98 0 3915
R-perm 4 16 4111578
R-recr 1 4 3977200
free 1937 0 226
freeabl 5815 11 2057
perm 271 89 343653
recr 11127 13 1250
SYS@ bys3>desc x$ksmsp
Name
------------
ADDR --在内存中地址
INDX --
INST_ID --
KSMCHIDX --
KSMCHDUR --
KSMCHCOM --chunk描述
KSMCHPTR --
KSMCHSIZ --chunk大小
KSMCHCLS --
KSMCHTYP --
KSMCHPAR --
SYS@ bys3>select count(*) from x$ksmsp; --每个chunk在x$ksmsp中都有记录,可以统计出chunk数量
COUNT(*)
----------
18704
###################

共享池中的 heap 堆和extent 区

heap 堆由一个或多个大小不一的extent组成,extent由chunk组成
DUMP 共享池查看heap/extent/chunk结构:--用新建会话来做
alter session set events 'immediate trace name heapdump level 2';
select value from v$diag_info where name like 'De%';
/u01/diag/rdbms/bys3/bys3/trace/bys3_ora_7876.trc
查看TRACE文件内容: --找这一段的方法:VI搜索HEAP DUMP
******************************************************
HEAP DUMP heap name="sga heap" desc=0x200010b4
extent sz=0x7ad4 alt=124 het=32767 rec=9 flg=-126 opc=0
parent=(nil) owner=(nil) nex=(nil) xsz=0x0 heap=(nil)
fl2=0x60, nex=(nil)
ds for latch 1: 0x20030f24
reserved granule count 0 (granule size 4194304)
******************************************************
HEAP DUMP heap name="sga heap(1,0)" desc=0x20030f24
---heap name="sga heap(1,0)" 共享池中第1个子池 --高级堆的子缓冲区
extent sz=0xfc4 alt=124 het=32767 rec=9 flg=-126 opc=0
parent=(nil) owner=(nil) nex=(nil) xsz=0x400000 heap=(nil)
fl2=0x20, nex=(nil), dsxvers=1, dsxflg=0x0
dsx first ext=0x2c400000
latch set 1 of 1
durations disabled for this heap
reserved granules for root 0 (granule size 4194304)
EXTENT 0 addr=0x23c00000 ---EXTENT 0,向下搜索还有多个EXTENT的,一个EXTENT有多个Chunk
Chunk 23c00038 sz= 24 R-stopper "reserved stoppe"
Chunk 23c00050 sz= 14300 R-free " "
Chunk 23c0382c sz= 8224 R-freeable "KKSSP^38 " ds=0x23d8f480
Chunk 23c0a8e4 sz= 169732 R-free " "
Chunk 23c33fe8 sz= 24 R-stopper "reserved stoppe"
Chunk 23c34000 sz= 15776 perm "perm " alo=15776
Chunk 23c37da0 sz= 84 free " " -- free状态的CHUNK,23c37da0 内存地址,84字节,可以看到各chunk大小不一
Chunk 23c37df4 sz= 236 recreate "KGLHD " latch=(nil) ---recreate状态的CHUNK, latch=(nil) 没有latch
#####
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

See all articles