← ClaudeAtlas

mysql-patternslisted

MySQL and MariaDB schema, query, indexing, transaction, replication, and connection-pool patterns for production backends. Use when designing MySQL or MariaDB schemas and indexes, or when a query, transaction, or replica lags.
userInner/SKILLS · ★ 3 · API & Backend · score 72
Install: claude install-skill userInner/SKILLS
# MySQL Patterns Use this skill when working on MySQL or MariaDB schema design, migrations, slow-query investigation, queue-style transactions, connection pools, or production database configuration. Prefer exact version checks before applying a feature-specific pattern because MySQL and MariaDB have diverged in several SQL details. ## Activation - Designing MySQL or MariaDB tables, indexes, and constraints - Reviewing migrations before they run on large production tables - Debugging slow queries, lock waits, deadlocks, or connection exhaustion - Adding keyset pagination, upserts, full-text search, JSON columns, or queues - Configuring application connection pools, read replicas, TLS, or slow logs ## Version Check Start by identifying the engine and version: ```sql SELECT VERSION(); SHOW VARIABLES LIKE 'version_comment'; ``` Keep MySQL and MariaDB guidance separate when syntax differs: - MySQL documents row aliases as the replacement for `VALUES(col)` in `ON DUPLICATE KEY UPDATE`; `VALUES(col)` is deprecated there. - MariaDB documents `VALUES(col)` as the supported way to reference inserted values in `ON DUPLICATE KEY UPDATE`; use it for cross-engine compatibility. - `SKIP LOCKED` is appropriate for queue-like work only. It skips locked rows and can return an inconsistent view, so do not use it for general accounting or integrity-sensitive reads. ## Schema Defaults ```sql CREATE TABLE orders ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, account_id BI