Search code examples
sqlcloudgoogle-cloud-spanner

How to see indexes for a database or table in Google Spanner?


How do I see if my database has any indexes on it?

How about for a specific table?


Solution

  • There are two ways to find the exising indexes.

    1. GCP console UI: Pantheon , navigate to Spanner -> Instance -> Database -> Table. Indexes can be found under 'Indexes' sub-tab.

    2. Command line gcloud query.

      gcloud spanner databases execute-sql {DATABAES_NAME} --instance={INSTANCE_NAME} --sql="SELECT * FROM INFORMATION_SCHEMA.INDEXES"