Cloud Spanner read vs Cloud Spanner SQL API
Asked Answered
C

1

6

There are two different APIs provided by Cloud Spanner. What’s the difference between Cloud Spanner read vs Cloud Spanner SQL API?

Comptroller answered 17/2, 2017 at 16:45 Comment(0)
C
6

Under the hood, they both use the same execution machinery, so you should see very similar performance for both APIs.

The SQL API is more expressive, since it supports constructs like ORDER BY, LIMIT, filtering, etc. But in some cases the Read API can be simpler to use. For example if you're just doing a simple table range scan on a table with a multi-column primary key, and you want to see all rows with primary key greater than ("A","B","C") and less than ("X","Y","Z").

If you have any doubt about which API to use, I would recommend using the query (SQL) API, as it can grow with you as you realize your simple request actually increases in complexity as your application changes organically over time. You need to add an extra selection condition? That is no problem with the SQL API. You actually need to change the ordering of your result set? That is also easy.

Comptroller answered 17/2, 2017 at 16:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.