Spanner API support

Recently Google announced a public release of Spanner in Google Cloud. It’s in Beta for now and it already has a Go client library available.

Since Cockroach has the same idea behind it, I was wondering is there any plans to support the same API?

There are no current plans to support the Cloud Spanner API, though it is definitely something for us to think about. Supporting the RPC protocol would be relatively straightforward, but I imagine most people would also want us to support that same SQL syntax which would be significantly harder.

It would be great if at least RPC parts will be supported. It will allow us to omit SQL for our use case. And it might cover some of KV API requests.

Any implementation of the Spanner API would be built on top of our SQL implementation. The code paths for “simple” tables with no indexes or foreign keys have very small overhead (single digit percent slowdowns) for INSERT/UPDATE/UPSERT/DELETE. For example, a simple “kv” table might be defined as:


Adding or replacing a row would be:

UPSERT INTO kv VALUES (1, 'hello'::bytes)

Under the hood, this translates into a single KV Put operation and the overhead to this translation is minimal. The upside is large as you still have a SQL table for which there is a well defined query language (if you ever need it), a known transaction model and you can add more columns to the table if the need arises. Want this to look like just keys and values? Add some simple wrapper code in the language of your choice.