Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Spanner — Equivalent Syntax for `SHOW TABLES`?

It's not clear how to run a query (or conduct an API call) to list all tables. Is this possible with Spanner?

like image 620
abhillman Avatar asked Feb 21 '17 05:02

abhillman


People also ask

How do I see tables in GCP?

Use a bash terminal, on Cloud Shell or on your computer, with mysql client already installed. then run the command gcloud sql connect to connect the database; the mysql client is automatically run by this command. After logged in into the database, you can perform a use <database>; and a show tables; to explore it.

What are interleaved tables in Spanner?

There are two types of tables in Spanner: root tables (sometimes called top-level tables), and interleaved tables. Interleaved tables are defined by specifying another table as its parent, causing rows in the interleaved table to be clustered with the parent row.

Does Cloud Spanner support SQL?

Cloud Spanner is a fully managed, mission-critical, relational database service that offers transactional consistency at global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: Google Standard SQL (ANSI 2011 with extensions) and PostgreSQL.

How to run queries efficiently on Cloud Spanner database?

You can write a query which selects rows from a parent table and interleaved tables at once with SELECT AS STRUCT subqueries. This allows you to run queries efficiently while consuming less CPU utilization on the Cloud Spanner database.

What is Google Cloud Spanner table interleaving?

Cloud Spanner is a fully-managed, horizontally scalable relational database service by Google. One of the unique capabilities of Cloud Spanner is table interleaving, which allows you to define parent-child relationships between tables. The data in interleaved tables are physically co-located and it can improve read and write performance.

What is a transaction in Cloud Spanner?

A transaction in Cloud Spanner is a set of reads and writes that execute atomically at a single logical point in time across columns, rows, and tables in a database. Cloud Spanner supports these transaction modes:

Does Cloud Spanner detect multiple schema versions of a statement?

These types of statements don't always create multiple schema versions, though. Cloud Spanner will try to detect when these types of statements can be optimized to avoid using multiple schema versions, which depends on batching.


1 Answers

Ah, looks like this is documented here: https://cloud.google.com/spanner/docs/information-schema. In particular:

SELECT
  t.table_name
FROM
  information_schema.tables AS t
WHERE
  t.table_catalog = '' and t.table_schema = ''
like image 152
abhillman Avatar answered Nov 15 '22 10:11

abhillman