MySQL Architecture and Engine
-
Upload
abdul-manaf -
Category
Documents
-
view
126 -
download
3
Transcript of MySQL Architecture and Engine
![Page 1: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/1.jpg)
MySQL Architecture & Engines
![Page 2: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/2.jpg)
Learning Objectives
• Understand MySQL Architecture
• How MySQL Uses Disk space and Memory
• Storage Engines
>MySQL Interaction with Storage Engines
>Major Storage engines with details below for each engine◦ Characteristics / Features ◦ Storage format◦ Transaction Support◦ Locking◦ Special Features
![Page 3: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/3.jpg)
MySQL Architecture
![Page 4: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/4.jpg)
MySQL Architecture
![Page 5: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/5.jpg)
The brains of the MySQL server
Component FeatureParsing Responsible for deconstructing the
requested SQL statementsOptimizing Responsible for finding the optimal
execution plan for the queryExecuting Responsible for executing the
optimized path for the SQL command passed through the parser and optimizer
Query Cache The query cache is a fast in-memory store to quickly look up the result set of a particular SELECT statement
Storage Engines Enables MySQL to use different implementations for storing, retrieving and indexing data
![Page 6: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/6.jpg)
How MySQL uses Disk and Memory
![Page 7: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/7.jpg)
How MySQL Uses Disk Space
• Data directory• Table and view format files (.frm)• Server log files and status files• Trigger storage• System database (MySQL)
![Page 8: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/8.jpg)
How MySQL Memory
Two different types memory allocation• per-session (allocated for each connection
thread)>Session specific>Dynamically allocated and deallocated>Mostly utilized for handling query results>Buffer sizes usually per session
• per-instance (allocated once for the entire server)>Allocated only once (per server instance)>Shared by the server processes and all of its
threads
![Page 9: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/9.jpg)
How MySQL Memory
• Server allocates memory for the following• Thread caches• Buffers• MEMORY tables• Internal temporary tables• Client specific buffers
![Page 10: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/10.jpg)
MySQL Engines
![Page 11: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/11.jpg)
Storage Engines
A storage engine is a software module that a database management system uses to create, read, update data from a database
• Client sends requests to the server as SQL
• Two-tier processing>Upper tier includes SQL parser and optimizer>Lower tier comprises a set of storage engines
• SQL tier not dependent on storage engine>Engine setting does not effect processing>Some Exceptions
![Page 12: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/12.jpg)
MySQL Interaction with Storage Engines
![Page 13: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/13.jpg)
What makes Storage Engine different
• Storage medium• Transactional capabilities• Locking• Backup and recovery• Optimization• Special features>Full-text search>Referential integrity>Spatial data handling
![Page 14: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/14.jpg)
Available Storage Engines
![Page 15: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/15.jpg)
Engines
• View Available Storage Engines>SHOW ENGINES
• Setting the Storage Engine>Specify engine using CREATE TABLE>CREATE TABLE t (i INT) ENGINE = InnoDB;
• Uses system default if not set>--default-storage-engine>@@storage_engine
• Change storage engine using ALTER TABLE>ALTER TABLE t ENGINE = MEMORY;
![Page 16: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/16.jpg)
The MyISAM Storage Engine
The MyISAM storage engine was the default storage engine from MySQL 3.23 until it was replaced by InnoDB in MariaDB and MySQL 5.5.
![Page 17: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/17.jpg)
MyISAM Row Storage Formats
![Page 18: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/18.jpg)
Compressing MyISAM Tables
![Page 19: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/19.jpg)
The InnoDB Storage Engine
![Page 20: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/20.jpg)
InnoDB Tablespace
![Page 21: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/21.jpg)
Multiple Tablespace
![Page 22: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/22.jpg)
MyISAM versus InnoDB
![Page 23: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/23.jpg)
The MEMORY Storage Engine(1/2)
![Page 24: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/24.jpg)
The MEMORY Storage Engine(2/2)
![Page 25: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/25.jpg)
ARCHIVE Storage Engine
![Page 26: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/26.jpg)
ARCHIVE Storage
![Page 27: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/27.jpg)
ARCHIVE Retrieving and Archiving
![Page 28: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/28.jpg)
CSV Storage Engine
![Page 29: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/29.jpg)
Choosing Appropriate Storage Engines
![Page 30: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/30.jpg)
Choosing Appropriate Storage Engines
![Page 31: MySQL Architecture and Engine](https://reader035.fdocuments.in/reader035/viewer/2022062316/58abb0c71a28ab04618b458f/html5/thumbnails/31.jpg)
Thank You!Your Questions Please