Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The MySQL Workshop

You're reading from   The MySQL Workshop A practical guide to working with data and managing databases with MySQL

Arrow left icon
Product type Paperback
Published in Apr 2022
Publisher Packt
ISBN-13 9781839214905
Length 726 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Scott Cosentino Scott Cosentino
Author Profile Icon Scott Cosentino
Scott Cosentino
Thomas Pettit Thomas Pettit
Author Profile Icon Thomas Pettit
Thomas Pettit
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Creating Your Database
2. Chapter 1: Background Concepts FREE CHAPTER 3. Chapter 2: Creating a Database 4. Chapter 3: Using SQL to Work with a Database 5. Chapter 4: Selecting, Aggregating, and Applying Functions 6. Section 2: Managing Your Database
7. Chapter 5: Correlating Data across Tables 8. Chapter 6: Stored Procedures and Other Objects 9. Chapter 7: Creating Database Clients in Node.js 10. Chapter 8: Working with Data Using Node.js 11. Section 3: Querying Your Database
12. Chapter 9: Microsoft Access – Part 1 13. Chapter 10: Microsoft Access – Part 2 14. Chapter 11: MS Excel VBA and MySQL – Part 1 15. Chapter 12: Working With Microsoft Excel VBA – Part 2 16. Section 4: Protecting Your Database
17. Chapter 13: Getting Data into MySQL 18. Chapter 14: Manipulating User Permissions 19. Chapter 15: Logical Backups 20. Other Books You May Enjoy Appendix

Storage engines (InnoDB and MyRocks)

MySQL storage engines are software modules that MySQL server uses to write, read, and update data in the database. There are two types of storage engines – transactional and non-transactional:

  • Transactional storage engines permit write operations to be rolled back if it fails; thus, the original data remains unchanged. A transaction may encompass several write operations. Imagine the transfer of funds from one account to another in the company accounting system; debiting funds from one account and crediting them to another is a single transaction. If the failure happens near the end of the transaction, all preceding operations will be rolled back, and nothing in the transaction will be committed. If all write tasks were successful, the transaction would be committed, and all changes will be made permanent. Most storage engines are transactional, like InnoDB.
  • Non-Transactional storage engines commit the data immediately on execution. If a write operation fails toward the end of a series of write operations, the preceding operations will need to be rolled back manually by code. To do so, the user will likely need to have recorded the old values elsewhere to know what they were. With the accounting example, imagine that the funds were debited from the first account but failed to be credited to the second, and the initial debit was not reversed. In this case, the funds would simply disappear. An example of this type of engine is MyISAM.

Another consideration when selecting a storage engine is if it is ACID-compliant.

ACID compliance

ACID compliance ensures data integrity in case of intermittent failures on different layers, such as broken connectivity, storage failure, and server process crash:

  • Atomicity ensures all distinct operations within a transaction are treated as a single unit, meaning that if one fails, they all fail. This ensures no transaction is left partially done. If the transaction is successful, the changes are committed to the storage layer, and data is guaranteed to be correct.
  • Consistency ensures a transaction cannot bring the database to an invalid state. Any data written must comply with all defined rules in the database, including constraints, cascades, triggers, and the referential integrity of the primary and foreign keys. This will prevent the corruption of data caused by an illegal transaction.
  • Isolation ensures that no part of the transaction is visible to other users or processes until the entire transaction is completed.
  • Durability ensures that once the transaction is committed, it will remain committed even in the event of a system failure, or power failure. The transaction is recorded in a logon store that is non-volatile.

The default storage engine of MySQL is InnoDB, and it is ACID-compliant. There are other types of storage engines as well that store and manipulate the data differently. If you are interested in learning more about what type of storage engines are available for MySQL, you can refer to the following link: https://dev.mysql.com/doc/refman/8.0/en/storage-engines.html.

In the next section, you will take a look at how different applications can connect to your database through the application layer

You have been reading a chapter from
The MySQL Workshop
Published in: Apr 2022
Publisher: Packt
ISBN-13: 9781839214905
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image