JSON, Emojis, GIS, And GraalVM: MySQL 8.0 Speaks To Modern Developers In Their Language
Mysql 23-May-2018

JSON, Emojis, GIS, And GraalVM: MySQL 8.0 Speaks To Modern Developers In Their Language

The world’s most popular open source database is MySQL, and it is used by plenty of hip companies like Facebook, Slack, Airbnb, Alibaba, and the world’s biggest web property, Tencent (which owns WeChat). The developers who use MySQL are as fond of the 23-year-old database as they are of their trendy tattoos. But they also want web-friendly, schema-free data models like JSON, which sparked interest in complementary NoSQL document stores.

With the recent release of MySQL 8.0, the database adds NoSQL features that appeal to the next generation of cloud-native developers. This lets those developers use relational database systems without having to scour for a separate document database.

“People love NoSQL document stores for rapid prototyping, but as your application matures, you run into pain points,” says Stockholm-based Tomas Ulin, Oracle’s MySQL vice president of engineering. Those NoSQL pain points can mean lost data, verbose code, managing multiple tools, and the lack of robust querying. The newest version of MySQL changes all that, Ulin says.

MySQL 8.0 adds other exciting features for global developers. One is geographic information system support with functions that support computations on longitude and latitude. Another is UTF8MB4 as the new default character set. That’s a two-for-one benefit, because the larger character set not only includes emoji, which is increasingly common in chatbot and social apps, it incorporates the encodings for all the world’s non-Latin languages. In other words, MySQL is embracing both the ideograms and idioms of the newest generation of developers—worldwide.

There’s also a managed version of MySQL for those cloud-natives who prefer to work with services rather than on-premises software. Powered by Oracle Cloud, MySQL Cloud Service is built on MySQL Enterprise Edition and delivers management tools, self-service provisioning, elastic scalability, and multilayer security.

JSON Without Compromise

Developers often trade power for productivity. When the short-term convenience of JSON becomes restrictive, however, the new MySQL is here to help.

“Many people associate JSON with basic insert-update-delete CRUD operations, but in business, JSON is much more complex,” says Manyi Lu, engineering director for the MySQL optimizer team. “Very often, they need more advanced SQL features like grouping and aggregation. So what you can do now is store JSON data in MySQL, and we still provide the full relational infrastructure for complex queries.”

These new features include extended syntax, aggregation functions, and JSON table functions, plus file sizes of up to a gigabyte. All this runs at up to two times faster processing speed than MySQL 5.7, which introduced the JSON datatype, indexing, and basic JSON functions. With MySQL 8, the goal was to deliver leading-edge NoSQL capabilities, while keeping all the proven capabilities of the MySQL relational database.

“We really tried to develop a new language. We tried to learn the best things we could do from the popular NoSQL databases like MongoDB, and then we innovated because we can do better and we can improve,” says Ulin.

GraalVM and the Kubernetes MySQL Operator

MySQL’s capabilities and support are growing in ways beyond JSON, GIS, emoji, and the other enhancements that come with MySQL 8.0. There was much excitement at the recent KubeCon conference in Copenhagen, for example, about the MySQL Operator, a Kubernetes controller that makes the creation of production-ready MySQL clusters as easy as using a simple declarative configuration format.

There’s also been buzz about GraalVM. Part of a larger project within Oracle, this multilanguage runtime can be embedded within MySQL via the MLE language plugin. As a result, stored procedures become much easier with GraalVM.

“There is a use case for stored procedures where you operate the data very close to the database to avoid the cost of network latencies,” says Ulin. “But it has been another language to learn, and both from a portability standpoint—because every database has their own stored procedure language—and from the developer’s perspective—if you are developing in JavaScript, to another language here—it’s a challenge,” says Ulin. Bringing GraalVM into the picture lets you take the client code you wrote in JavaScript and run that same logic closer to your data, giving you more languages that can execute at the server side.

“The real value of a language is its ecosystem,” agrees Christian Wimmer, a researcher at Oracle Labs. “You use JavaScript for server-side things, with NumPy you get a lot of analytics, and in a language like R, you get every possible statistics function you could imagine.”

GraalVM is “not just any JIT [just-in-time] compiler—it’s a state-of-the-art JIT compiler,” says Wimmer. “It will give you better performance than you have ever seen for languages like Ruby and Python.”

“If you are an app developer, you want to have a way to store and retrieve your data that is more native to the language you are operating in. You don’t want to have to transform both your queries and your data into some other representation through SQL strings or relational mapping and so on,” says Ulin. “There’s always been a bridge there that you had to jump. This way it fits right into your application, and it feels very natural.”

Alexandra Weber Morales is an Oracle director of developer content.