Design and Manage TiDB Databases Visually with DbSchema

DbSchema lets you design, manage, and document TiDB databases. Create ER diagrams, define tables and columns, and generate SQL scripts - with or without a live database connection.

Use Git to share the design, compare it with the TiDB database, and deploy changes. DbSchema also includes a data editor, query builder, and HTML5 documentation - everything you need in one tool.

DbSchema Database Designer

Download DbSchema Download TiDB JDBC Driver

TiDB's Distributed HTAP Architecture and Schema Visualization

TiDB is a distributed Hybrid Transactional and Analytical Processing (HTAP) database developed by PingCAP. Its architecture separates compute (TiDB SQL layer) from storage, with TiKV providing row-oriented storage for OLTP workloads and TiFlash providing columnar replica storage for OLAP workloads. Both storage engines are kept consistent via the Raft consensus protocol, so analytical queries on TiFlash always read fresh, consistent data without the lag typically associated with ETL pipelines.

TiDB exposes a MySQL-compatible SQL interface on port 4000 (note: not MySQL's standard port 3306). DbSchema connects via the MySQL Connector/J driver and reverse-engineers the full schema — tables, views, indexes, and TiFlash replica definitions — into a visual diagram. Because TiDB handles automatic sharding (called region splitting) transparently, the schema diagram looks identical to what you would see with a single-node MySQL database, abstracting away the distributed internals.

TiDB HTAP schema with TiKV and TiFlash replica definitions visualized in DbSchema

Writing SQL Against TiDB's MySQL-Compatible Interface

TiDB is compatible with the MySQL 5.7 and 8.0 protocol and SQL syntax, which means standard MySQL queries — joins, subqueries, window functions, CTEs, full-text search — work without modification. DbSchema's SQL editor sends queries via MySQL Connector/J and returns results in the built-in grid. You can run both transactional OLTP queries against TiKV and analytical OLAP queries that TiDB automatically routes to TiFlash replicas, all from the same query tab.

TiDB-specific SQL hints such as /*+ READ_FROM_STORAGE(TIFLASH[table]) */ can be added directly in the SQL editor to force columnar execution for analytical workloads, while EXPLAIN ANALYZE shows the distributed query plan including which operators ran on TiKV versus TiFlash. This level of query plan visibility helps you optimize hybrid workloads that mix row reads and aggregation-heavy analytics.

Writing MySQL-compatible SQL against TiDB HTAP in DbSchema

Exploring TiDB Table Data Across OLTP and OLAP Replicas

The DbSchema data explorer connects to TiDB and presents table data in a familiar row-by-row browsing interface. You can page through records, filter by column values, and inspect individual rows from any TiDB table regardless of whether that table has a TiFlash columnar replica enabled. This is useful for validating that TiFlash replication has converged after initially adding a replica to a large table.

TiDB Cloud, PingCAP's managed service, provides the same MySQL-compatible connection interface, so the same DbSchema connection profile works for both self-hosted TiDB clusters and TiDB Cloud Serverless or Dedicated tiers. The data explorer's CSV export makes it straightforward to pull samples from the columnar replica for comparison with expected analytical results.

Browsing TiDB table data in the DbSchema data explorer

Connecting DbSchema to TiDB

Select MySQL as the database type in DbSchema. TiDB uses MySQL Connector/J (com.mysql.cj.jdbc.Driver), which DbSchema includes by default. The JDBC URL format is: jdbc:mysql://tidb-host:4000/mydb. The critical difference from a standard MySQL connection is the port: TiDB listens on 4000 by default, not 3306. Entering the wrong port is the most common connection error when setting up TiDB for the first time.

For TiDB Cloud connections, copy the connection string from the TiDB Cloud console. It will include the cluster hostname, port 4000, and require SSL. Add ?useSSL=true&requireSSL=true to the JDBC URL or configure SSL in the DbSchema connection dialog's advanced settings. The TiDB root user password is set during cluster creation; there is no default empty password as there is with some local MySQL installations.

Why Teams Use DbSchema with TiDB

  • Visualizes TiDB's HTAP schema including TiFlash replica configurations alongside standard table definitions.
  • Enables both OLTP and OLAP query authoring from a single SQL editor connected to a single database endpoint.
  • Leverages the familiar MySQL Connector/J path — teams already using MySQL tooling need minimal setup changes.
  • Makes distributed query plans from EXPLAIN ANALYZE easier to review in the results grid.
  • Supports TiDB Cloud connections with the same profile format, unifying on-premises and cloud management.
  • Generates offline schema documentation for distributed SQL databases, which are often harder to document than single-node RDBMS instances.