I’ve always had a dream:
Want a database that can scale up to hundreds of nodes, be easy to learn and understand, run in private Cloud, public Cloud, multi-cloud, Kubernetes, embedded devices like Raspberry PI, and even cooler, run directly in a browser. And you don’t need any browser extensions
Pocket Database“, like the movie Ant-Man.

Today, it’s all happening: TiDB runs directly in the browser. Open a browser, you can directly create a database, add, delete, change and check data. Close the browser and everything disappears, clean and green

Start by opening play.pingcap.com in your laptop browser (I’m using Chrome on MacOS, not sure if it works in any other browser), which may take a few seconds to load the page, and then you’ll see your familiar Shell. Now let’s try some SQL statements! Since TiDB is basically compatible with the MySQL protocol and syntax, we can operate in the familiar MySQL style, as shown in the following figure:

Figure 1 running TiDB on a browser
Isn’t that cool? It’s time to experience SQL painlessly.
What’s cool is that this all runs in the browser local, delete library no longer have to run 😈
With that in mind, it’s time to add features to online SQL tutorial sites, such as running SQL statements simultaneously during text tutorials. Here’s a simple demonstration:

Figure 2 SQL tutorial site demo
So what are the other benefits of running a database in a browser?
Remember the pain of installing and configuring your database? From now on, everyone can have a database anytime, anywhere, no more painful installation process, no more painful configuration parameters, anytime to enjoy the pleasure of writing SQL. Perhaps indexDB is no longer needed, SQL is a more advanced API, and TiDB makes “write once, run anywhere” a reality.
Of course, you must be wondering how it all works:
  • One of the most exciting features I’ve seen recently is WebAssembly (Wasm) support for Go, which makes it possible to run applications written in Go in the browser.

  • Then thank PingCAP for working with the community to implement the open source distributed database TiDB. We compiled TiDB into Wasm and ran the generated Wasm files directly in the browser, which made it possible to run a database in the browser. If memory serves, TiDB seems to be the first SQL database written in Go that runs in a browser;

  • Special thanks to the participants of TiDB Hackathon 2019 and their interesting ideas, especially to the Ti-Cool team. Thanks to their efforts, this project won the second prize of Hackathon 2019, and the teachers of the on-site judging panel were also impressed. We are also looking forward to its speedy landing!

“Tidb-wasm has significantly lowered the threshold for users to experience TiDB capabilities and initially verify SQL compatibility. The experience is as smooth as Golang Playground, and the emergence of Wasm has provided new ideas for TiDB document center construction. Perhaps in the near future, TiDB users, like Golang, will be able to read a document and have a hands-on experience on the page at the same time. We also look forward to the continued development of Wasm, the sandboxed operation of TiKV, the provision of playground closer to the real operation scene, and even more novel ideas in the direction of automated operation and maintenance management.”

Team leader – n.syed (Meituan | database)


“When I first saw this project, I was really impressed. It is a very cool idea, and it is really helpful for DBA operation and maintenance management of TiDB. I strongly hope that this project can be implemented and supported as soon as possible.

At present, when our company uses TiDB, a large part of it is connected by the current business. However, a very important problem is that the applications are originally developed based on MySQL. Although TiDB has done a lot of work on the compatibility of SQL syntax, it still fails to cover 100%. Therefore, we must test SQL syntax compatibility and verify data accuracy before switching services. Since TiDB is deployed on an online server, our production and office network environments are isolated based on data security. To meet the above requirements, we have the following methods: a) The r & D students write scripts to connect and check by themselves; B)DBA login to the cluster to assist verification; C) Develop dedicated query platform support. None of these methods is currently safe and efficient. As we maintain more and more TiDB clusters, DBAs are frustrated with this inefficiency and are in urgent need of tool support. Tidb-wasm will undoubtedly solve this problem, so I hope the authorities will pay attention to this project and implement it as soon as possible.”

Senior managers – Yu Bowei (58 group | database)


“Wasm is an amazing technology. It probably started out as a way to solve the problem of how fast JS runs and how other languages manipulate HTML, but now people are experimenting with a lot of possibilities with this technology. Tidb-wasm is a great attempt to make TiDB much easier for newcomers, provide a fantastic operating environment for documentation presentations, and greatly reduce the difficulty of building native debugging environments for application developers. I believe this idea can give other server-side software a good inspiration.”

– debian developer (jingdong cloud | senior director)


“Many users want to get to know TiDB but have trouble finding an easy-to-use offline environment, which causes them to give up before they even get started. Tidb-wasm promises to solve this problem completely. Based on TIDB-WASM, users can easily open session to explore TiDB features and functions, debug TiDB behavior, and compare TiDB and MySQL databases in SQL syntax, locking behavior, transaction isolation level and other details. To help users understand TiDB more deeply. For the authorities, best practices such as routing, computing, storage layer capacity expansion and migration can be integrated into the platform and visualized to give users a more realistic and intuitive feeling. This is an exciting product that will help the TiDB community thrive and benefit all TiDB users!”

– zhao should steel (Meituan comments | distributed database platform development and operations, head researcher)


“The tiDB-WASM project successfully ported TiDB to Wasm, demonstrating the feasibility of TiDB to Wasm, and reflecting the maturity of WebAssembly. More projects will be ported to run in browsers in the future. At present, the project is still in the demo stage. If the project continues to be implemented in the future, more functions will be added to it, such as using indexedDB for data persistence, using technologies such as WebrTC for TiDB in different browsers to carry out P2P communication and realize distributed browser database. I’m really looking forward to that.”

– secooler (shell find | data technical director)


“Tidb-wasm opened my eyes to more possibilities for TiDB. Wasm itself is a very ambitious and imaginative technology that greatly expands the capabilities of the front end. For those of you who have played with interactive experience platforms like Go Playgound and Rust Playground on the Web, Tidb-wasm takes it one step further and allows users to experience it directly even offline, making it extremely easy to use. From a practical point of view, in addition to being a REPL in a browser for quick documentation and experimentation, TIDB-WASM could even be a good future complement to JS’s localStorage API. Providing a high-performance local database for the JS ecosystem beyond SQLite… Of course, there are still plenty of improvements to be made to the experience, such as slimming down Binary and adding cluster mode support. It’s been a fun project overall.”

– Huang Dongxu (PingCAP | co-founder and CTO)


“It’s kind of a combination of novelty and utility, in a very clever way, where you have a core infrastructure like a database and you have a cool front end, and then the two can collide. The most immediate use is to significantly reduce the cost of TiDB experience for users. With only a browser page and waiting time for Binary to download, there is no need to install and deploy TiDB to experience the basic functions of TiDB, whether it is embedded ina document to run an instance quickly or as a Playgroud site for users to play freely. All fit perfectly. As a further extension, TiDB can be seen as a substitute for MySQL, so many MySQL teaching sites can also use Wasm to improve the teaching experience. Of course, the SQL teaching demonstrated in the Demo is only the most basic gameplay, with this thing, we can say: congratulations to the front-end circle on a JS version of MySQL. I believe the front end of the students can play it out of flowers. In a word: this is definitely a hit and a hit.”

– ShenLi (PingCAP | Engineering VP)



Here are some more interesting ideas we can try:

  • More online SQL tutorials can be run directly.

  • Getting TiDB to run on Go Playground may require the help of the Go Team.
  • Persistent database support, we have cloud computing, edge computing, why not browser computing?