MySQL compatibility
Overview
PlanetScale is built on top of open-source Vitess, a database clustering system for horizontal scaling of MySQL. Consequently, PlanetScale is only compatible with MySQL databases.
PlanetScale databases run on MySQL 8. If you're importing an existing database, PlanetScale supports MySQL database versions 5.7
through 8.0
.
New PlanetScale databases are created on MySQL 8 with character set utf8mb4_0900_ai_ci
. PlanetScale supports utf8
, utf8mb4
, and utf8mb3
, character sets. We also support latin1
and ascii
character sets, but do not recommend them.
MySQL compatibility limitations
The following reference guide will cover some MySQL syntax, features, and more that PlanetScale either does not support or has limitations around. We are actively working on driving up compatibility, but it's an ongoing effort and will take some time to complete. See this project board on GitHub to learn what the Vitess team is currently focusing on.
If you're attempting to import a database using our Import tool, there are some additional requirements that you can find in our Database imports documentation.
Queries, functions, syntax, data types, and SQL modes
Note
❗ = Limitations in support
❌ = Not supported
Statement | Support | Description |
---|---|---|
ALTER TABLE...RENAME COLUMN | ❌ | Renaming columns and tables may be destructive. See our guide for column rename recommendations. |
CREATE DATABASE | ❌ | You cannot CREATE a PlanetScale database from the MySQL command line, however, this is supported in the PlanetScale CLI. |
DROP DATABASE | ❌ | You cannot DROP a PlanetScale database from the MYSQL command line, however, this is supported in the PlanetScale CLI. |
JSON_TABLE | ❌ | The JSON_TABLE function is not yet supported. All other JSON SQL functions should work. |
PROCEDURE | ❌ | We do not support any form of stored routines. |
FUNCTION | ❌ | We do not support any form of stored routines. |
TRIGGER | ❌ | We do not support any form of stored routines. |
EVENT | ❌ | We do not support any form of stored routines. |
LOAD DATA INFILE | ❌ | Loading data via LOAD DATA INFILE is not supported. |
KILL | ❌ | We do not support killing queries or shards from the command line. |
:= | ❌ | The := assignment operator is not yet supported. |
SET GLOBAL time_zone | ❌ | The global time zone is set to UTC and can not be modified. |
SET GLOBAL sql_mode | ❌ | The global SQL mode can not be changed permanently. Set each new session's mode instead with SET sql_mode . |
PIPES_AS_CONCAT | ❌ | Enabling this SQL mode can interfere with Vitess' evalengine parsing the SQL queries so enabling it may result in incorrect or unexpected results. Please use MySQL's standard dialect instead, e.g. CONCAT() . |
ANSI_QUOTES | ❌ | Enabling this SQL mode can interfere with Vitess' evalengine parsing the SQL queries so enabling it may result in incorrect or unexpected results. Please use MySQL's standard quotation instead. |
INSERT ... AS ... | ❌ | In an INSERT ... AS ... statement, aliasing the columns or rows is not yet supported. |
WITH RECURSIVE | ❌ | We do not support recursive common table expressions (CTEs) |
Miscellaneous
Action | Support | Description |
---|---|---|
Empty schemas | ❌ | Databases with empty schemas are invalid. You cannot deploy a schema change to production if no tables exist. |
Non-InnoDB Storage engine | ❌ | We only support InnoDB storage engine. |
No applicable unique key | ❌ | We require all tables have a unique, non-null key and that respective covered columns are shared between old and new schema. |
Direct DDL | ❌ | We do not allow Direct DDL on production branches when safe migrations is enabled. This includes TRUNCATE statements. |
Binary log access | ❌ | PlanetScale does not currently support binlog replication to external databases. |
Large JSON documents | ❗ | MySQL supports JSON documents up to 1 GB in size. However, we do not recommend to store more than a few MB in a JSON document for performance reasons. |
FAQ
Postgres support
PlanetScale does not support PostgreSQL. We have worked with customers to migrate their Postgres databases to MySQL/PlanetScale. If you have questions about migrating, get in touch.
Need help?
Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.