Overview
MariaDB is a fork of MySQL that maintains compatibility while adding improvements. ChartDB’s MariaDB support includes:- MySQL-compatible Smart Query
- Enhanced GROUP_CONCAT support
- InnoDB statistics
- Full DDL import/export
Smart Query Import
The MariaDB Smart Query is based on the MySQL query with optimizations for MariaDB features.MariaDB Query
Always run
SET SESSION group_concat_max_len = 10000000; before the query to prevent truncation of large result sets.What the Smart Query Retrieves
The MariaDB Smart Query retrieves the same metadata as MySQL:- Foreign Keys: Full FK definitions with update/delete rules
- Primary Keys: Single and composite primary keys
- Columns: All data types, lengths, precision, defaults, and comments
- Indexes: Index statistics from
mysql.innodb_index_stats - Tables: Table information including storage engine and row counts
- Views: View names and schemas
SQL Import/Export
MariaDB uses the same SQL import and export functionality as MySQL.Import Features
MariaDB can import all MySQL-compatible DDL:- CREATE TABLE statements
- All MariaDB/MySQL data types
- AUTO_INCREMENT columns
- Storage engines (InnoDB, MyISAM, Aria, etc.)
- Foreign keys with referential actions
- Indexes (BTREE, HASH, FULLTEXT)
- Views
- CHECK constraints (MariaDB 10.2.1+)
Export Example
MariaDB-Specific Features
Storage Engines
MariaDB supports additional storage engines beyond MySQL:- InnoDB: Default transactional engine
- Aria: Crash-safe MyISAM replacement
- ColumnStore: Columnar storage for analytics
- Spider: Sharding/partitioning engine
- MyRocks: RocksDB-based engine
Enhanced CHECK Constraints
MariaDB has supported CHECK constraints since version 10.2.1:Sequences
MariaDB 10.3+ supports sequences (similar to PostgreSQL):ChartDB does not currently have dedicated sequence support, but you can use AUTO_INCREMENT for similar functionality.
JSON Data Type
MariaDB 10.2+ supports native JSON:Key Differences from MySQL
CHECK Constraints
CHECK Constraints
MariaDB has full CHECK constraint support since 10.2.1, while MySQL only added it in 8.0.16.
Storage Engines
Storage Engines
MariaDB offers additional engines like Aria and ColumnStore that aren’t available in MySQL.
Performance
Performance
MariaDB often has better query optimization and performance for complex queries.
Licensing
Licensing
MariaDB is fully GPL-licensed, while MySQL has a dual license model (GPL + Commercial).
Best Practices
Choose InnoDB or Aria
Use InnoDB for transactional tables, Aria for non-transactional with better crash recovery than MyISAM
Troubleshooting
GROUP_CONCAT truncation
GROUP_CONCAT truncation
The Smart Query may be truncated for large databases. Increase the limit:
Permission errors
Permission errors
Ensure your user has SELECT permissions on:
information_schema.*mysql.innodb_index_stats
CHECK constraints not working
CHECK constraints not working
CHECK constraints require MariaDB 10.2.1+. For older versions, they are parsed but not enforced.
Inline REFERENCES not supported
Inline REFERENCES not supported
Like MySQL, MariaDB doesn’t support inline REFERENCES. Use table-level FOREIGN KEY constraints.
Compatibility Notes
- SQL Syntax: MariaDB is highly compatible with MySQL syntax
- Data Type Conversion: Use the same type mappings as MySQL
- Import/Export: MariaDB can import MySQL dumps and vice versa (with some engine exceptions)
- Smart Query: Works identically to MySQL with minor optimizations
