Mysql en Vs PDF
Mysql en Vs PDF
fl
• Data types;
• Architecture;
• Indexes;
• Isolation
Numeric Data Types
• BIGINT: from -9 223 372 036 854 775 808 to 9 223 372 036 854 775 807, takes 8 bytes
• BIGINT UNSIGNED: from 0 to 18 446 744 073 709 551 615, takes 8 bytes
Numeric Data Types
• TIME: stores time from -838:59:59 to 838:59:59. By default it stores data using
“hh:mm:ss" format. Takes 3 bytes.
• ENUM: stores single value from the list of allowed values. Takes 1-2 bytes
CREATE TABLE tickets (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
priority ENUM('Low', 'Medium', 'High') NOT NULL
);
INSERT INTO tickets(title, priority) VALUES('Scan virus for computer A', 'High');
INSERT INTO tickets(title, priority) VALUES('Upgrade Windows OS for all computers', 1);
Union Types
• SET: stores multiple values from the list of allowed values (up to 64 possible
values). Takes 1-8 bytes.
INSERT INTO Users (user_id, group_id, user_name) VALUES (2, 1, 'Петров П.П.');
INSERT INTO Users VALUES (3, 1, ‘Петрович П.П.'), (4, NULL, 'Сидоров С.С.');
• MyISAM
• Memory
• CSV
• Archive
• Blackhole
NDBCLUSTER
InnoDB
• FOREIGN KEY
• Transactions
• ACID
• Atomicity
• Consistency
• Isolation
• Durability
• Bu er pool
• Change bu er
• Double write bu er
ff
ff
ff
• Primary Key
• Unique
• Index
B-tree Index
B-tree Index
B-tree Index
B-tree Index
Complex index
SELECTMy
* FROM users WHERE age => 10 AND gender = 'male'
Snapshot of the SELECT is taken the rst time the SELECT is run
during the transaction and the same snapshot is used throughout the
transaction when the same SELECT is executed
fi
Isolation levels
READ COMMITED
Each SELECT uses its own snapshot of the committed data that was
committed before the execution of the SELECT. Now because each
SELECT has its own snapshot, here is the trade-o now, so the same
SELECT, when running multiple times during the same transaction,
could return di erent result sets
ff
ff
Isolation levels
READ UNCOMMITTED
• Terminal
• DataGrip
• HeidiSQL
What we cannot use
• PhpMyAdmin
NoSQL
• 7 databases in 7 weeks
• High Performance MySQL, 4th Edition
• Designing Data-Intensive Applications - Kleppmann
Questions?