Install
openclaw skills install mariadbWrite efficient MariaDB queries with proper indexing, temporal tables, and clustering.
openclaw skills install mariadbutf8mb4 for tables and connections—full Unicode including emojiutf8mb4_unicode_ci for proper linguistic sorting, utf8mb4_bin for byte comparisonSET NAMES utf8mb4 or in connection stringINDEX (description(100))(a, b) serves WHERE a=? but not WHERE b=?SHOW INDEXCREATE SEQUENCE seq_name for guaranteed unique IDs across tablesNEXT VALUE FOR seq_name to get next—survives transaction rollbackSETVAL(seq_name, n) to reset—useful for migrationsALTER TABLE t ADD SYSTEM VERSIONING to track all historical changesFOR SYSTEM_TIME AS OF '2024-01-01 00:00:00' queries past stateFOR SYSTEM_TIME BETWEEN start AND end for change historyrow_start and row_end store validity periodJSON_VALUE(col, '$.key') extracts scalar, returns NULL if not foundJSON_QUERY(col, '$.obj') extracts object/array with quotes preservedJSON_TABLE() converts JSON array to rows—powerful for unnestingJSON_VALID() before insert if column isn't strictly typedwsrep_sync_wait = 1 before critical reads—ensures node is syncedwsrep_cluster_size should be odd number—avoids split-brainROW_NUMBER() OVER (PARTITION BY x ORDER BY y) for ranking within groupsLAG(col, 1) OVER (ORDER BY date) for previous row valueSUM(amount) OVER (ORDER BY date ROWS UNBOUNDED PRECEDING) for running totalWITH cte AS (...) for readable complex queriesthread_handling=pool-of-threads—better than thread-per-connectionthread_pool_size = CPU cores for CPU-bound, higher for I/O-boundSHOW STATUS LIKE 'Threadpool%'SHOW TABLE STATUS WHERE Name='table'SELECT ... FOR UPDATE locks rows until commitLOCK TABLES t WRITE for DDL-like exclusive access—blocks all other sessionsinnodb_lock_wait_timeout default 50s—lower for interactive appsEXPLAIN ANALYZE for actual execution times (10.1+)optimizer_trace for deep dive: SET optimizer_trace='enabled=on'FORCE INDEX (idx) when optimizer chooses wrong indexSTRAIGHT_JOIN to force join order—last resortmariadb-dump --single-transaction for consistent backup without locksmariadb-backup for hot InnoDB backup—incremental supportedmysqlbinlog binlog.000001 | mariadbmax_connections or use connection poolSHOW ENGINE INNODB STATUSON DUPLICATE KEY UPDATE