Configure Spanner columnar engine

Preview —Spanner columnar engine

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

For information about access to this release, see the access request page.

Note: This feature is available with the Spanner Enterprise edition and Enterprise Plus edition. For more information, see theSpanner editions overview.

This page describes how to enable Spanner columnar engine on adatabase, table, or index, and accelerate file format generation.

Enable Spanner columnar engine

Spanner columnar engine is enabled using aSET OPTIONS clausewith thecolumnar_policy option. You can apply this option when you create oralterDATABASE,TABLE, orINDEX schema objects.SEARCH INDEX andVECTOR INDEX schema objects are never in columnar format.

Lower levels in a database and table hierarchy inherit thecolumnar_policyfrom its parent. You can change this setting at lower levels.

Thecolumnar_policy option has the following flags:

You can also omitOPTIONS to inherit thecolumnar_policy from the parentobject.

The following example shows how to:

CREATEDATABASEMusic;ALTERDATABASEMusicSETOPTIONS(columnar_policy='enabled');CREATETABLESingers(SingerIdINT64NOTNULL,FirstNameSTRING(1024),LastNameSTRING(1024),BirthDateDATE,StatusSTRING(1024),LastUpdatedTIMESTAMP,)PRIMARYKEY(SingerId);CREATETABLEConcerts(VenueIdINT64NOTNULL,SingerIdINT64NOTNULL,ConcertDateDATENOTNULL,BeginTimeTIMESTAMP,EndTimeTIMESTAMP,)PRIMARYKEY(VenueId,SingerId,ConcertDate),OPTIONS(columnar_policy='disabled');

You can also useALTER TABLE with theSET OPTIONS clause to enable ordisable thecolumnar_policy on a table. The following example shows how todisable the policy in theSingers table:

ALTERTABLESingersSETOPTIONS(columnar_policy='disabled');
Note: Enabling Spanner columnar engine increases thestorage usage of the target database or table (depending on the enabling optionused). It's important to ensure that theSpanner instance has sufficient storage capacity to accommodatethe increase in storage usage. For more information, seeDatabase limits.

Columnar file format generation

Spanner generates the columnar file format at compaction time.Compaction is a background process that typically is spread out over multipledays, but it might happen sooner if the size of the database growssubstantially. For more information, seeOptimal columnar coverage.

Note: You can contactspanner-columnar-preview@google.comto request accelerated generation of columnar format for existing data.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.