SlideShare a Scribd company logo
MySQL with FaCE
안미진
7/4/2016 1
Contents
7/4/2016 2
• Hash Table Format
• Creating a Hash Table
• Insertion in Hash Table
• Deletion in Hash Table
Hash Table Format
7/4/2016 3
Type of hash table, type
Adaptive hash index flag, adaptive
Number of cells in the hash table, n_cells
Pointer to cell array, array
Number of mutexes or rw_locks, n_sync_obj
Synchronization objects (mutex or rw_lock), sync_obj
Heaps, heaps
Heap, heap
Magic number, magic_n
void* node
mutexes
rw_locks
hash_table_t
Hash Table Format
7/4/2016 4
• type: type of hash table
 HASH_TABLE_SYNC_NONE
 HASH_TABLE_SYNC_MUTEX
 HASH_TABLE_SYNC_RW_LOCK
• adaptive: TRUE if this is the hash table of the adaptive hash
index
• n_cells: number of cells in the hash table
• array: pointer to cell array
 node: hash chain node, NULL if none
Hash Table Format
7/4/2016 5
• n_sync_obj: the number of mutexes or rw_locks, must be a
power of 2 or 0
• sync_obj: synchronization objects
① mutexes: NULL or an array of mutexes used to protect segments of
hash table
② rw_locks: NULL or an array of read/write locks
• heaps: if this is non-NULL, hash chain nodes for external
chaining can be allocated from these memory heaps
• heap
• magic_n: magic number (76561114)
Creating a Hash Table
7/4/2016 6
buf_pool_
init()
buf_pool_init
_instance()
ha_create()
ha_create
_func()
hash_create()
Initialized
hash table
hash table
buf_pool
->page_hash
buf_pool_init_instance()
7/4/2016 7
• buf/buf0buf.cc:1349
ha_create()
7/4/2016 8
• include/ha0ha.h:110
ha_create_func()
7/4/2016 9
• ha/ha0ha.cc:67
hash_create()
7/4/2016 10
Allocate memory for
hash table and hash entries
Initialize the elements
of hash table
• ha/hash0hash.cc:293
ha_create_func()
7/4/2016 11
Create a hash table
protected by
rw_locks or mutex
for buf_pool
• ha/ha0ha.cc:80
Insertion in Hash Table
7/4/2016 12
buf_page_
get_gen()
buf_read_
page()
buf_read_
page_low() buf_page_init
_for_read()
buf_page_init()
buf_block_init_low()
buf_page_init_low()
HASH_INSERT
fil_io()
HASH_SEARCH
buf_LRU_get_free_block()
Page Hash - Hash Table
7/4/2016 13
HASH_SEARCH
7/4/2016 14
• include/hash0hash.h:197
buf_page_init()
7/4/2016 15
• buf/buf0buf.cc:3510
HASH_INSERT
7/4/2016 16
DATA
(hash entry)
NULL
DATA
(hash entry)
NULL
struct3333
(hash entry)
hash
entry
hash
entry
There is no hash entry
If there are other hash
entries, find last hash entry
and insert DATA into the
next of the last hash entry
• include/hash0hash.h:122
Deletion in Hash Table
7/4/2016 17
buf_LRU_get
_free_block()
buf_LRU_scan_and
_free_block()
buf_LRU_free
_page()
buf_LRU_block_
remove_hashed()
HASH_DELETE
buf_LRU_get
_free_only()
buf_page_can_relocate()
HASH_DELETE
7/4/2016 18
1. Check whether the next
hash entry of DATA is valid
2. Change the pointer to point
the next hash entry
DATA
(hash entry)
hash
entry
hash
entry
DATA
(hash entry)
hash
entry
hash
entry
(void*)-1
: invalid address
• include/hash0hash.h:158

More Related Content

PDF
MySQL Space Management
PDF
Secondary Index Search in InnoDB
PDF
InnoDB Flushing and Checkpoints
PDF
InnoDB MVCC Architecture (by 권건우)
PDF
MySQL Buffer Management
PDF
How to Analyze and Tune MySQL Queries for Better Performance
PDF
MySQL innoDB split and merge pages
PPTX
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
MySQL Space Management
Secondary Index Search in InnoDB
InnoDB Flushing and Checkpoints
InnoDB MVCC Architecture (by 권건우)
MySQL Buffer Management
How to Analyze and Tune MySQL Queries for Better Performance
MySQL innoDB split and merge pages
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx

What's hot (20)

PPTX
Transactional operations in Apache Hive: present and future
PDF
writing self-modifying code and utilizing advanced assembly techniques
PPT
40 demand paging
PPTX
What is Link list? explained with animations
PDF
Understanding DLmalloc
PDF
PostgreSQL, performance for queries with grouping
PDF
Heap exploitation
PPTX
Python Data Structures and Algorithms.pptx
PDF
Applications of Stack
PDF
Advanced Apache Spark Meetup Project Tungsten Nov 12 2015
PDF
MySQL查询优化浅析
PDF
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
PDF
Facebook Presto presentation
PDF
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
PDF
InnoDB Internal
PDF
Histogram-in-Parallel-universe-of-MySQL-and-MariaDB
PPTX
Heaps & its operation -Max Heap, Min Heap
PDF
MySQL 5.5 Guide to InnoDB Status
PDF
Primeiros passos com a API do Zabbix
PDF
Optimizing S3 Write-heavy Spark workloads
Transactional operations in Apache Hive: present and future
writing self-modifying code and utilizing advanced assembly techniques
40 demand paging
What is Link list? explained with animations
Understanding DLmalloc
PostgreSQL, performance for queries with grouping
Heap exploitation
Python Data Structures and Algorithms.pptx
Applications of Stack
Advanced Apache Spark Meetup Project Tungsten Nov 12 2015
MySQL查询优化浅析
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Facebook Presto presentation
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
InnoDB Internal
Histogram-in-Parallel-universe-of-MySQL-and-MariaDB
Heaps & its operation -Max Heap, Min Heap
MySQL 5.5 Guide to InnoDB Status
Primeiros passos com a API do Zabbix
Optimizing S3 Write-heavy Spark workloads
Ad

Similar to MySQL Hash Table (20)

PPTX
Mca ii dfs u-5 sorting and searching structure
PPTX
Bca ii dfs u-4 sorting and searching structure
PPTX
Bsc cs ii dfs u-4 sorting and searching structure
PDF
Page Cache in Linux 2.6.pdf
PDF
Advanced data structures vol. 1
PPTX
Lec12-Hash-Tables-27122022-125641pm.pptx
PPTX
Hash table
PDF
L21_Hashing.pdf
PPTX
Hashing Techniques in database management systems
PPTX
Hashing_UNIT2.pptx
PPT
Hashing gt1
PPT
PPTX
Elmasri Navathe Primary Files database A
PDF
PDF
5 data storage_and_indexing
PDF
Database management system chapter thirt
PPTX
Hash Table.pptx
PPTX
files,indexing,hashing,linear and non linear hashing
PPT
Data Indexing Presentation-My.pptppt.ppt
PPT
Unit 3 chapter-1managing-files-of-records
Mca ii dfs u-5 sorting and searching structure
Bca ii dfs u-4 sorting and searching structure
Bsc cs ii dfs u-4 sorting and searching structure
Page Cache in Linux 2.6.pdf
Advanced data structures vol. 1
Lec12-Hash-Tables-27122022-125641pm.pptx
Hash table
L21_Hashing.pdf
Hashing Techniques in database management systems
Hashing_UNIT2.pptx
Hashing gt1
Elmasri Navathe Primary Files database A
5 data storage_and_indexing
Database management system chapter thirt
Hash Table.pptx
files,indexing,hashing,linear and non linear hashing
Data Indexing Presentation-My.pptppt.ppt
Unit 3 chapter-1managing-files-of-records
Ad

Recently uploaded (20)

PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Transform Your Business with a Software ERP System
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
ai tools demonstartion for schools and inter college
PDF
AI in Product Development-omnex systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
Odoo Companies in India – Driving Business Transformation.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Transform Your Business with a Software ERP System
ISO 45001 Occupational Health and Safety Management System
VVF-Customer-Presentation2025-Ver1.9.pptx
PTS Company Brochure 2025 (1).pdf.......
L1 - Introduction to python Backend.pptx
Online Work Permit System for Fast Permit Processing
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Odoo POS Development Services by CandidRoot Solutions
ManageIQ - Sprint 268 Review - Slide Deck
ai tools demonstartion for schools and inter college
AI in Product Development-omnex systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Operating system designcfffgfgggggggvggggggggg

MySQL Hash Table

Editor's Notes

  • #4: the clustered key fields, also known as a Primary Key Value
  • #5: the clustered key fields, also known as a Primary Key Value
  • #6: the clustered key fields, also known as a Primary Key Value