Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

MySQL Database Engines (Storage Engines) คืออะไร?

Storage Engine คืออะไร?

โมดูลซอฟต์แวร์ที่ DBMS ใช้สร้าง อ่าน อัปเดต ข้อมูลจากฐานข้อมูล

Default Engine ปัจจุบัน: InnoDB

ดู Engine ทั้งหมด

mysql> SHOW ENGINES;

ผลลัพธ์ (สรุป)

EngineSupportCommentTransactionsXASavepoints
InnoDBDEFAULTรองรับ Transactions, Row-locking, FKYESYESYES
MyISAMYESFull-text search, ไม่มี TransactionsNONONO
MEMORYYESHash-based, ใน RAM, เร็วแต่หายเมื่อ RestartNONONO
CSVYESเก็บเป็นไฟล์ CSVNONONO
ARCHIVEYESCompressed, Insert-only, ไม่มี IndexNONONO
BLACKHOLEYES/dev/null เขียนได้ อ่านไม่ได้ (Replication)NONONO
PERFORMANCE_SCHEMAYESMonitoring ระบบNONONO
FEDERATEDNORemote tablesNULLNULLNULL
MRG_MYISAMYESรวม MyISAM tablesNONONO

เลือก Engine ไหน?

  • InnoDB: เริ่มต้น ใช้ทั่วไป ACID, FK, Row-locking
  • MyISAM: Read-heavy, Full-text (เก่า), ไม่ต้องการ Transaction
  • MEMORY: Temp tables, Cache, Lookup tables (ข้อมูลเล็ก)
  • ARCHIVE: Logs, Audit trail (Write-once, Compressed)
  • CSV: Exchange data with external tools