a curated list of database news from authoritative sources

July 05, 2020

What the Flush?

Yves Trudeau and Francisco Bordenave, MySQL experts at Percona, recently published a three-part post: (1) Give Love to Your SSDs – Reduce innodb_io_capacity_max!; (2) InnoDB Flushing in Action for Percona Server for MySQL; (3) Tuning MySQL/InnoDB Flushing for a Write-Intensive Workload. It’s a fantastic read from start to finish, and it made me realize: dirty pages sound bad, but they are good. I suspect the opposite (“dirty pages are not good”) is a misconception due to an incomplete picture. Let’s complete the picture.

July 01, 2020

June 29, 2020

21 Parameter Group Values to Change in Amazon RDS for MySQL

Amazon RDS for MySQL uses many default values for system variables, but it also sets a few “sys vars” with different values. As with any database, neither product (MySQL) nor provider (AWS) defaults can best suite all use cases. It’s our responsibility to carefully review and set every important system variable. This is tedious and difficult, but I’ve done it for you.

Below are are 21 MySQL 5.7 system variables that I recommend changing by creating a new parameter group. This presumes new RDS instances; some of these sys vars cannot be changed easily after provisioning MySQL. This only applies to RDS for MySQL, not Amazon Aurora.

June 15, 2020

June 14, 2020

Generating a full-stack application from a database

DBCore can now generate a TypeScript/React CRUD UI that is automatically hooked up to the generated REST API (in Go).

The UI has full support for login, viewing (and filtering), editing, and creating database entities.

PostgreSQL, SQLite and MySQL are supported.

How to use?

The goal of this project is primarily to provide as much useful boilerplate as possible for full-stack applications. The system is probably not sufficient to be an entire application development platform. It's currently missing hooks, overrides, and per-row/per-table authorization.

The UI code generation may be even less useful in the long-term than the API because UIs are by necessity very diverse. But it is good not to need to build the same browser-side API, authentication, and routing logic again now that it's taken care of in code generation.

Screenshots

Here are a few screenshots of the examples/todo application. Every page here is auto-generated after reading the database schema. The browser application is hooked up to the similarly auto-generated API.

Sign in
Creating a table entity
Viewing all table entities
Filtering table entities
Viewing an individual table entity
Editing a table entity

June 10, 2020

June 06, 2020

Generating a REST API from a database

I recently published an alpha version of a code generation tool, DBCore, that reads a database schema from PostgreSQL or MySQL and generates an entire Go API with CRUD operations, pagination, filtering, and authentication.

But more than just generating code like xo/xo or gnorm, DBCore defines a standard REST API that can be implemented in any language -- and includes a reference implementation in Go. I'm eager to add Java and Ruby implementations as well. And I'd be more than happy to accept community contributions.

Boilerplate & code generation

Web application boilerplate is boring. You should do it once from scratch (preferably down to the socket layer) and never do it again. I struggled for the last few years to find the right system to reduce boilerplate. If I were building a new line-of-business application as an employee I'd pick one of Rails, ASP.NET, Spring, Django, or similar.

I've never worked on one of those frameworks professionally and I've never been able to force myself to learn any of them in my free time. But even if I could use one of these, none of them get close to giving you an entire functioning application with authentication, pagination, filtering all based on your existing database.

Over the last few years though I've relied heavily on code generation for Go projects. Code generation is basically the only way to conserve type-safe code in Go. But it's similarly popular in more powerful languages like Java.

However none of the existing projects give you much flexibility or provide you with enough templates to be useful.

DBCore

DBCore is written in F# and can be distributed as a static binary on all systems .NET now supports (read: not just Windows!).

Reading from MySQL or PostgreSQL is supported but I'd like to see that extended to include SQLite, Oracle, and MS SQL at least.

As mentioned, currently DBCore only provides a Go REST API template. That only solves half the problem of building an application though. And while there are some projects that can generate an admin CRUD interface for you, I want to see that more tightly integrated into DBCore. So I'll be introducing a new template for a browser application as well. For each table in the database it will generate a page showing paginated entries and allow you to create, update, and delete.

Finally, while the tool only currently has a concept of "browser" and "api" templates, the project should be able to accept any kind of template and generate any text based on any database schema.