Transaction Control
Initiate a transactional block and commit changes:
BEGIN;
SELECT * FROM employees;
COMMIT;
Check the current auto-commit configuration:
SHOW VARIABLES LIKE 'autocommit';
By default, MySQL operates in auto-commit mode, treating every single statement as a distinct transaction. To disable this behavior:
SET autocommit = 0;
-- or
SET autocommit = OFF;
Adjust the isolation level for the current session (e.g., to Read Committed):
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
Storage Engines
Inspect the storage engine of a specific table (e.g., accounts):
SHOW TABLE STATUS LIKE 'accounts';
Switch a table's engine to InnoDB:
ALTER TABLE archive engine = InnoDB;
Duplicate a table structure (schema only) using LIKE:
CREATE TABLE archive_backup LIKE archive;
Performance Testing and Profiling
HTTP Load Testing
Create a list of URLs in urls.txt:
http://example.com/api
https://example.com/static/image.png
Run a test using http_load:
http_load -parallel 5 -seconds 30 urls.txt
Slow Query Log
The slow query log captures execution time, users, specific SQL statements, and rows returned. Its essential for identifying inefficient queries. A related feature, the