The TiDB User Guide for Application Developers is Released!

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 应用开发者专属的 TiDB 使用指南发布啦!

| username: Billmay表妹

As the TiDB user base continues to expand, TiDB documentation faces increasingly diverse challenges. Previously, the documentation primarily focused on TiDB deployment and operations. However, for application developers using TiDB, there is a greater need for a manual that explains how to use TiDB as easily as MySQL, while also leveraging TiDB’s unique features such as optimistic transactions, Sequence, and HTAP.

Therefore, we have compiled a brand-new Developer Guide. This document can help application developers get started with TiDB in the shortest possible time. In the documentation, we also address some of the most common issues faced by application developers, such as the incompatibility of the savepoint feature and how to handle errors when using TiDB’s optimistic transactions.

Additionally, we have made special optimizations and scenario customizations for application developers. For example, we provide ways to use TiDB Cloud clusters for developers who find it inconvenient to manage operations themselves; for developers who find it inconvenient to deploy TiDB locally or develop in an SDK environment, we offer assistance with using the Gitpod cloud-native development environment.

Developer Guide Overview

How to Use the Developer Guide

In our vision, the Developer Guide is very suitable but not limited to the following scenarios:

  • You are an application developer with a programming language background but no knowledge of databases, preparing to choose a NewSQL database for learning or use;
  • You are an application developer with a background in programming languages and traditional relational databases (such as MySQL, PostgreSQL), preparing to choose a NewSQL database for learning or use;
  • You are an application developer whose company or organization has already deployed TiDB, and you need to write a reliable application based on TiDB;
  • You are an application developer who has already written an application based on TiDB, but it has encountered issues, and you need to troubleshoot;
  • You are a language learner who wants to use a programming language in conjunction with a NewSQL database to attempt large-scale data reads and writes.

What Does the Developer Guide Include?

For application developers with no database background, the Developer Guide includes the TiDB details that developers need to know, such as database design, transactions, and best practices for data reading and writing, along with rich application source code examples to help you get started with TiDB from scratch. For developers with a MySQL background, the Developer Guide details the differences between TiDB and MySQL, helping you quickly transition to using the new generation of NewSQL databases. For developers already using TiDB at work, the rich application source code examples and troubleshooting cases in the Developer Guide can also help you improve your TiDB development efficiency.

In addition to TiDB-related content, we have also written about some details you need to pay attention to when writing applications, such as using the JDBC Connector in Java. Meanwhile, the Developer Guide also hides TiDB details that application developers do not need to worry about, such as TiDB’s GC, scheduling, and cluster component configurations.

The main contents of the Developer Guide are as follows:

  • Overview: An introduction to the overall development documentation;
  • Quick Start: How to build an application using Java or Golang;
  • Sample Programs: How to build an HTTP service using Spring Boot and the TiDB cluster;
  • Connecting to TiDB: What to pay attention to when connecting to the TiDB database, how to configure the maximum number of connections in the connection pool;
  • Database Schema Design: How to avoid most errors when designing a database using TiDB. What features in TiDB can significantly improve performance in specific scenarios;
  • Data Writing and Reading: How to set up read-intensive and write-intensive tables to maximize performance. How to avoid pitfalls in batch operations;
  • Transactions: What are the characteristics of TiDB transactions, and how do they differ from MySQL;
  • Optimizing SQL Performance: How to make your SQL run faster in TiDB;
  • Troubleshooting: How to quickly locate and fix issues when they occur;
  • Cloud-Native Development Environment: How to use the cloud-native development environment (Gitpod) for free to write programs, avoiding the need to deploy a local development environment;

As you can see, the entire document is example-driven. Java examples and Golang examples are the core of the entire document creation, and all code snippets in the document have been tested. Based on these examples, application developers can get started with TiDB in the shortest possible time, without a long learning curve or high entry barriers, and can easily and quickly use TiDB in their programs. Through these examples, application developers can also quickly understand TiDB’s capabilities, such as what TiDB can accomplish, the best scenarios, and unsupported features.

Simple CRUD Application

Since TiDB is compatible with MySQL, after successfully deploying the TiDB cluster, developers can use the MySQL client to connect to TiDB and, in most cases, directly execute MySQL statements. In the Developer Guide, we also briefly introduce basic CRUD SQL, such as in the article on using TiDB for CRUD SQL, where we focus on the DML (Data Manipulation Language) and DQL (Data Query Language) parts that are most closely related to application developers.

Quick Experience with TiDB on Gitpod

For developers who find it inconvenient to deploy a local development environment, we also provide assistance with using the Gitpod cloud-native development environment. Gitpod is a cloud-native development environment that supports GitHub, allowing you to edit and run code directly in your browser. You can even deploy your service directly to Gitpod’s machines, open ports, and access it remotely.

Based on Gitpod, we provide a TiDB Golang example for developers who cannot deploy TiDB or develop in an SDK environment. By opening this link, you can directly start a remote TiDB development environment from your browser or desktop IDE and quickly experience TiDB’s capabilities.

Update Plan

In the future, we plan to write more examples of languages/drivers/ORMs to help more application developers use TiDB. If you have any suggestions for improving the Developer Guide, you are welcome to provide feedback. You can submit feedback through GitHub issues:

| username: 阿福Chris | Original post link

Thoughtful, even though there are no points, I’ll still give it a thumbs up~

| username: lxs_data | Original post link

Good. I hope the documentation can be as comprehensive as reading MySQL/Oracle documentation.

| username: Kongdom | Original post link

Cousin yyds