Databases overview

This page describes Spanner databases and their properties.

Overview

A Spanner database is a container for your tables, views, and indexes. Each Spanner instance can have multiple databases.

In the Spanner hierarchy, a database is a child of an instance, and the parent of a schema.

A database inherits properties from its parent instance, such as its configuration (regional or multi-region), the available compute capacity, and the available storage.

Properties that are set on the database are:

  • The dialect. Spanner supports GoogleSQL and PostgreSQL. All of the tables in a database must use the same dialect.
  • An IAM policy. The access rules defined by this policy are applied to the tables and data inside the database.
  • The type of encryption key to use. The default is a Google-managed key; a customer-managed encryption key is also supported.
  • Database deletion protection to prevent accidental deletion of databases.
  • Database policies such as the default leader region, query optimizer version, query optimizer statistics package version, and version retention period, can be set or modified with DDL statements. See the DDL reference for GoogleSQL or PostgreSQL.

Database limits, including the number of databases allowed per instance, and the number of tables allowed per database, are defined on the Quotas and limits page.

Considerations

Before creating a database, consider the implications of your schema design. Read Schema design best practices, as well as the Schema and data model document, particularly the section on Designing for multi-tenancy.

What's next