Create and manage locality groups

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 create and manage Spannerlocality groups. You can use locality groups to define thetiered storage policy for data in your database schema. For information abouthow tiered storage works, seeTiered storage.

Create a locality group

You can create a locality group without any tiered storage policy, or you cancreate a locality group to define the storage policy for data in your databaseschema.

If you create a locality group without a tiered storage policy, the localitygroup inherits the tiered storage policy of thedefault locality group. If youhaven't manually set the storage policy of thedefault locality group, thenthe storage policy is set to SSD-only.

Console

  1. Go to the SpannerInstances page in theGoogle Cloud console.

    Instances

  2. Select the instance in which you want to use tiered storage.

  3. Select the database in which you want to use tiered storage.

  4. In the navigation menu, clickSpanner Studio.

  5. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.

  6. Enter theCREATE LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, you can run the following to create a locality group,separate_storage, that stores columns in a separate file than the datafor the rest of the columns:

    GoogleSQL

    CREATELOCALITYGROUPseparate_storage;

    PostgreSQL

    CREATELOCALITYGROUPseparate_storage;

    For example, you can run the following to create a locality group,ssd_only, that stores data on SSD storage:

    GoogleSQL

    CREATELOCALITYGROUPssd_onlyOPTIONS(storage='ssd');

    PostgreSQL

    CREATELOCALITYGROUPssd_onlySTORAGE'ssd';

    For example, you can run the following to create a locality group,hdd_only, that stores data on HDD storage:

    GoogleSQL

    CREATELOCALITYGROUPhdd_onlyOPTIONS(storage='hdd');

    PostgreSQL

    CREATELOCALITYGROUPhdd_onlySTORAGE'hdd';
  7. ClickRun.

gcloud

To create a locality group with the gcloud CLI command, usegcloud spanner databases ddl update.

For example, you can run the following to create a locality group,separate_storage, that stores columns in a separate file than the datafor the rest of the columns:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP separate_storage"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP separate_storage"

For example, you can run the following to create a locality group,ssd_only, that stores data on SSD:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP ssd_only OPTIONS (storage='ssd')"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP ssd_only STORAGE 'ssd'"

For example, you can run the following to create a locality group,hdd_only, that stores data on HDD storage:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP hdd_only OPTIONS (storage='hdd')"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP hdd_only STORAGE 'hdd'"

Create an age-based policy for a locality group

A locality group with an age-based policy stores newer data in SSD storage for aspecified time. This time is relative to the data's commit timestamp. After thespecified time passes, Spanner migrates the data to HDD storageduring its normal compaction cycle, which typically occurs over the course ofseven days from the specified time. When using an age-based tiered storagepolicy, the minimum amount of time that data must be stored in SSD before it'smoved to HDD storage is one hour.

To create an age-based locality group, use theCREATE LOCALITY GROUP DDLstatement.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theCREATE LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, the following DDL statement creates a locality group,spill_to_hdd, that stores data on SSD storage for the first 10 days,and then migrates older data to HDD storage over the normal compactioncycle:

    GoogleSQL

    CREATELOCALITYGROUPspill_to_hddOPTIONS(storage='ssd',ssd_to_hdd_spill_timespan='10d');

    PostgreSQL

    CREATELOCALITYGROUPspill_to_hddSTORAGE'ssd'SSD_TO_HDD_SPILL_TIMESPAN'10d';
  3. ClickRun.

gcloud

To create an age-based locality group with the gcloud CLI command,usegcloud spanner databases ddl update.

For example, the following DDL statement creates a locality groupspill_to_hdd that stores data in SSD for the first 10 days, and thenmigrates older data to HDD over the normal compaction cycle.

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP spill_to_hdd OPTIONS (storage='ssd', ssd_to_hdd_spill_timespan='10d')"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE LOCALITY GROUP spill_to_hdd STORAGE 'ssd' SSD_TO_HDD_SPILL_TIMESPAN '10d'"

Set a tiered storage policy for your data

After you create your locality group, you can set the tiered storage policy foryour data. The tiered storage policy determines the locality group that the datauses. You can set the tiered storage policy at the database, table, column, orsecondary index-level. Each database object inherits its tiered storage policyfrom its parent, unless it's explicitly overridden.

If you create a locality group without a tiered storage policy, the localitygroup inherits the tiered storage policy of thedefault locality group. If youhaven't manually set the storage policy of thedefault locality group, thenthe storage policy is set to SSD-only.

Set a database-level locality group

The default tiered storage policy is that all data is stored on SSD storage. Youcan change the database-level tiered storage policy by altering thedefaultlocality group. For GoogleSQL-dialect databases, yourALTER LOCALITY GROUP DDL statement must havedefault within backticks(`default`). You only need to include the backticks for thedefaultlocality group.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theALTER LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements alter thedefault localitygroup to use an age-based tiered storage policy. All data in the databaseis moved to HDD storage after 10 days.

    GoogleSQL

    ALTERLOCALITYGROUP`default`SETOPTIONS(storage='ssd',ssd_to_hdd_spill_timespan='10d');

    PostgreSQL

    ALTERLOCALITYGROUP"default"STORAGE'ssd'SSD_TO_HDD_SPILL_TIMESPAN'10d';
  3. ClickRun.

gcloud

To alter the tiered storage policy of thedefault locality group with thegcloud CLI command, usegcloud spanner databases ddl update.

For example, the following DDL statements alter thedefault localitygroup to use an age-based tiered storage policy. All data in the database ismoved to HDD storage after 10 days.

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP \`default\` SET OPTIONS (storage = 'ssd', ssd_to_hdd_spill_timespan = '10d');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP \"default\" STORAGE 'ssd' SSD_TO_HDD_SPILL_TIMESPAN '10d';"

Set a table-level locality group

You can set a table-level tiered storage policy for your data that overrides thedatabase-level tiered storage policy. The table-level tiered storage policy isalso applicable to all columns in the table, unless you have set acolumn-level override tiered storage policy.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theCREATE TABLE DDL statement usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements create a table,Singers, thatuses the locality groupssd_only:

    GoogleSQL

    CREATETABLESingers(SingerIdINT64NOTNULL,FirstNameSTRING(1024),LastNameSTRING(1024),SingerInfoBYTES(MAX))PRIMARYKEY(SingerId),OPTIONS(locality_group='ssd_only');

    PostgreSQL

    CREATETABLESingers(SingerIdbigintPRIMARYKEY,FirstNamevarchar(1024),LastNamevarchar(1024),SingerInfobytea)LOCALITYGROUPssd_only;
  3. ClickRun.

gcloud

To set a table-level tiered storage policy with the gcloud CLIcommand, usegcloud spanner databases ddl update.

For example, the following DDL statements create a table,Singers, thatuses the locality groupssd_only.

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Singers ( SingerId   INT64 NOT NULL, \        FirstName  STRING(1024), \        LastName   STRING(1024), \        SingerInfo BYTES(MAX) \        ) PRIMARY KEY (SingerId), OPTIONS (locality_group = 'ssd_only');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Singers ( \        SingerId bigint PRIMARY KEY, \        FirstName  varchar(1024), \        LastName   varchar(1024), \        SingerInfo bytea \        ) LOCALITY GROUP ssd_only;"

Set a column-level override tiered storage policy

You can set a column-level override tiered storage policy for your data.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theCREATE TABLE DDL statement with a column-level overridetiered storage policy usingGoogleSQLorPostgreSQL.

    For example, the following DDL statements create aSingers table thatuses the locality groupssd_only. However, theAwards columnoverrides this table-level locality group and uses thespill_to_hddlocality group as its tiered storage policy:

    GoogleSQL

    CREATETABLESingers(SingerIdINT64NOTNULL,FirstNameSTRING(1024),LastNameSTRING(1024),AwardsARRAY<STRING(MAX)>OPTIONS(locality_group='spill_to_hdd'))PRIMARYKEY(SingerId),OPTIONS(locality_group='ssd_only');

    PostgreSQL

    CREATETABLESingers(SingerIdbigintPRIMARYKEY,FirstNamevarchar(1024),LastNamevarchar(1024),Awardsvarchar[]LOCALITYGROUPspill_to_hdd)LOCALITYGROUPssd_only;
  3. ClickRun.

gcloud

To set a column-level override tiered storage policy with thegcloud CLI command, usegcloud spanner databases ddl update.

For example, the following DDL statements create aSingers table thatuses the locality groupssd_only. However, theAwards columnoverrides this table-level tiered storage policy and uses thespill_to_hddlocality group as its tiered storage policy:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Singers ( \      SingerId   INT64 NOT NULL, \      FirstName  STRING(1024), \      LastName   STRING(1024), \      Awards     ARRAY<STRING(MAX)> OPTIONS (locality_group = 'spill_to_hdd') \    ) PRIMARY KEY (SingerId), OPTIONS (locality_group = 'ssd_only');"\

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Singers ( \      SingerId   bigint PRIMARY KEY, \      FirstName  varchar(1024), \      LastName   varchar(1024), \      Awards     varchar[] LOCALITY GROUP spill_to_hdd \    ) LOCALITY GROUP ssd_only;"

Set a secondary index-level override tiered storage policy

You can set a secondary index-level override tiered storage policy for your data.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theCREATE INDEX DDL statement with a secondary index-leveloverride tiered storage policy usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements create aSingers table thatuses the locality groupssd_only. The database also has a secondaryindex on allSingers in the database by their first and last name. TheSingersByFirstLastName index overrides the table-level tiered storagepolicy and uses thespill_to_hdd locality group as its tiered storagepolicy:

    GoogleSQL

    CREATEINDEXSingersByFirstLastNameONSingers(FirstName,LastName)OPTIONS(locality_group='spill_to_hdd');

    PostgreSQL

    CREATEINDEXSingersByFirstLastNameONSingers(FirstName,LastName)LOCALITYGROUPspill_to_hdd;
  3. ClickRun.

gcloud

To set a secondary index-level override tiered storage policy with thegcloud CLI command, usegcloud spanner databases ddl update.

For example, the following DDL statements create aSingers table thatuses the locality groupssd_only. The database also creates a secondaryindex on allSingers in the database by their first and last name. TheSingersByFirstLastName index overrides the table-level tiered storagepolicy and uses thespill_to_hdd locality group as its tiered storage policy:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE INDEX SingersByFirstLastName ON Singers(FirstName, LastName) \    OPTIONS (locality_group = 'spill_to_hdd');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE INDEX SingersByFirstLastName ON Singers(FirstName, LastName) \    LOCALITY GROUP spill_to_hdd;"

Set a column-level locality group

You can set a column-level locality group for your data even if the localitygroup doesn't have a tiered storage policy. Reading data from this column isfaster than reading data that is grouped with other columns.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theCREATE TABLE DDL statement that assigns the column to alocality group usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements create aSongs table with aLyricsCompressed column that is stored separately in thehdd_only locality group:

    GoogleSQL

    CREATETABLESongs(SingerIdINT64NOTNULL,SongIdINT64NOTNULL,TitleSTRING(MAX),DescriptionSTRING(MAX),LyricsCompressedBYTES(MAX)OPTIONS(locality_group='hdd_only'))PRIMARYKEY(SingerId,SongId),INTERLEAVEINPARENTSingersONDELETECASCADE,OPTIONS(locality_group='ssd_only');

    PostgreSQL

    CREATETABLESongs(SingerIdBIGINTNOTNULL,SongIdBIGINTNOTNULL,TitleVARCHAR,DescriptionTEXT,LyricsCompressedBYTEALOCALITYGROUPhdd_only,PRIMARYKEY(SingerId,SongId))LOCALITYGROUPssd_onlyINTERLEAVEINPARENTSingersONDELETECASCADE;
  3. ClickRun.

gcloud

To set a column-level locality group for your data with thegcloud CLI command, usegcloud spanner databases ddl update.

For example, the following DDL statements create aSongs table withaLyricsCompressed column that is stored separately in thehdd_only locality group:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Songs ( \      SingerId INT64 NOT NULL, \      SongId INT64 NOT NULL, \      Title STRING(MAX), \      Description STRING(MAX),      LyricsCompressed BYTES(MAX) OPTIONS (locality_group = 'hdd_only') \    ) PRIMARY KEY (SingerId, SongId), \      INTERLEAVE IN PARENT Singers ON DELETE CASCADE, \      OPTIONS (locality_group = 'ssd_only');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="CREATE TABLE Songs ( \      SingerId BIGINT NOT NULL, \      SongId BIGINT NOT NULL, \      Title VARCHAR, \      Description TEXT, \      LyricsCompressed BYTEA LOCALITY GROUP hdd_only, \      PRIMARY KEY (SingerId, SongId) \    ) LOCALITY GROUP ssd_only INTERLEAVE IN PARENT Singers ON DELETE CASCADE;

Move data between storage options

You can move data between SSD and HDD storage. Moving data can take up to sevendays. You can monitor the progress of the move by querying the built-inSPANNER_SYS.TABLE_SIZES_STATS_1HOUR table to check HDD and SSD storage usagefor each table in your database. You can also monitor your storage usage byusing the Cloud Monitoringspanner.googleapis.com/instance/storage/used_bytes metric to show the SSD andHDD breakdown for your database or instance. For more information, seetiered storage observability.

Move data from SSD to HDD storage

To move data from SSD to HDD storage, you can create a new locality group withan aged-based tiered storage policy, or change the tiered storage policy of anexisting locality group. Spanner moves data during its normalcompaction cycle, which typically occurs over the course of seven days. Ifyou're loading data and updating your locality group using one of the followingALTER DDL statements, then you must wait up to seven days for the change tothe locality group to complete:

GoogleSQL

  • ALTER TABLE ... SET OPTIONS (locality_group = '')
  • ALTER TABLE ... ALTER COLUMN ... SET OPTIONS (locality_group = '')
  • ALTER INDEX ... SET OPTIONS (locality_group = '')

PostgreSQL

  • ALTER TABLE ... SET LOCALITY GROUP ...
  • ALTER TABLE ... ALTER COLUMN ... SET LOCALITY GROUP ...
  • ALTER INDEX ... SET LOCALITY GROUP ...

The waiting period isn't applicable if you're creating a new table, column, orindex, and adding the locality group as part of theCREATE orADD COLUMNsyntax.

For more information, seeCreate an age-based policy for a locality grouporChange the storage option.

Move data from HDD to SSD storage

To move data from HDD to SSD storage, you canchange the storage optionof an existing locality group oralter the locality group used by the table.Spanner moves data during its normal compaction cycle, whichtypically occurs over the course of seven days. If you're loading data andupdating your locality group using one of the followingALTER DDL statements,then you must wait up to seven days for the change to the locality group tocomplete:

GoogleSQL

  • ALTER TABLE ... SET OPTIONS (locality_group = '')
  • ALTER TABLE ... ALTER COLUMN ... SET OPTIONS (locality_group = '')
  • ALTER INDEX ... SET OPTIONS (locality_group = '')

PostgreSQL

  • ALTER TABLE ... SET LOCALITY GROUP ...
  • ALTER TABLE ... ALTER COLUMN ... SET LOCALITY GROUP ...
  • ALTER INDEX ... SET LOCALITY GROUP ...

The waiting period isn't applicable if you're creating a new table, column, orindex, and adding the locality group as part of theCREATE orADD COLUMNsyntax.

Alter the locality group used by a table

You can alter the locality group used by a table by setting a new or differentlocality group in the table options.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theALTER TABLE DDL statement that changes the locality groupused by the table usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements alter the locality group usedby the table,Singers, tospill_to_hdd:

    GoogleSQL

    ALTERTABLESingersSETOPTIONS(locality_group='spill_to_hdd');

    PostgreSQL

    ALTERTABLESingersSETLOCALITYGROUPspill_to_hdd;
  3. ClickRun.

gcloud

To alter the locality group used by a table with the gcloud CLIcommand, usegcloud spanner databases ddl update.

For example, the following DDL statements alter the locality group usedby the table,Singers, tospill_to_hdd:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER TABLE Singers SET OPTIONS(locality_group = 'spill_to_hdd');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER TABLE Singers SET LOCALITY GROUP spill_to_hdd;"

Alter the locality group used by a table's column

You can alter the locality group used by a table's column by setting thelocality group in the column options.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theALTER TABLE DDL statement that changes the locality groupused by the table usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements alter the locality group usedby the table's column,LastName, tospill_to_hdd:

    GoogleSQL

    ALTERTABLESingersALTERCOLUMNLastNameSETOPTIONS(locality_group='spill_to_hdd');

    PostgreSQL

    ALTERTABLESingersALTERCOLUMNLastNameSETLOCALITYGROUPspill_to_hdd;
  3. ClickRun.

gcloud

To alter the locality group used by a table with the gcloud CLIcommand, usegcloud spanner databases ddl update.

For example, the following DDL statements alter the locality group usedby the table's column,LastName, tospill_to_hdd:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER TABLE Singers ALTER COLUMN LastName SET OPTIONS(locality_group = 'spill_to_hdd');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER TABLE Singers ALTER COLUMN SET LOCALITY GROUP spill_to_hdd;"

Alter a locality group

You can alter a locality group bychanging its storage optionorchanging its age-based policy.Spanner moves data during its normal compaction cycle, whichtypically occurs over the course of seven days. If you're loading data andupdating your locality group usingALTER LOCALITY GROUP, then you must wait upto seven days for existing data to migrate. The updated setting applies toall new data written to that locality group immediately.

Change the storage option

You can change the storage option of a locality group from SSD to HDD or HDDto SSD.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theALTER LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements change the storage option ofthe locality group,separate_storage, to HDD:

    GoogleSQL

    ALTERLOCALITYGROUPseparate_storageSETOPTIONS(storage='hdd');

    PostgreSQL

    ALTERLOCALITYGROUPseparate_storageSTORAGE'hdd';
  3. ClickRun.

gcloud

To change the storage option of a locality group with the gcloud CLIcommand, usegcloud spanner databases ddl update.

For example, the following DDL statements change the storage option ofthe locality group,separate_storage, to HDD:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP separate_storage SET OPTIONS (storage = 'hdd');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP separate_storage STORAGE 'hdd';"

Change the age-based policy

You can change the age-based policy of a locality group by extending orshortening the time that data is stored in SSD before it's moved to HDD storage.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theALTER LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, the following DDL statements change the age-based policy ofthe locality group,spill_to_hdd, by extending the amount of timethat data is stored in SSD to 20 days:

    GoogleSQL

    ALTERLOCALITYGROUPspill_to_hddSETOPTIONS(ssd_to_hdd_spill_timespan='20d');

    PostgreSQL

    ALTERLOCALITYGROUPspill_to_hddSSD_TO_HDD_SPILL_TIMESPAN'20d';
  3. ClickRun.

gcloud

To change the age-based policy of a locality group with the gcloud CLIcommand, usegcloud spanner databases ddl update.

For example, the following DDL statements change the age-based policy ofthe locality group,spill_to_hdd, by extending the amount of timethat data is stored in SSD to 20 days:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP spill_to_hdd SET OPTIONS (ssd_to_hdd_spill_timespan = '20d');"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="ALTER LOCALITY GROUP spill_to_hdd SSD_TO_HDD_SPILL_TIMESPAN '20d';"

Delete a locality group

You can't delete a locality group if it contains data. You must firstmove all data that's in the locality group to another locality group. For moreinformation, seeAlter the locality group used by the table.

Console

  1. On theSpanner Studio page, clickNew tab or use the emptyeditor tab.
  2. Enter theDROP LOCALITY GROUP DDL statement usingGoogleSQL orPostgreSQL.

    For example, you can run the following to drop a locality groupssd_only:

    GoogleSQL

    DROPLOCALITYGROUPssd_only;

    PostgreSQL

    DROPLOCALITYGROUPssd_only;
  3. ClickRun.

gcloud

To drop a locality group with the gcloud CLI command, usegcloud spanner databases ddl update.

For example, to drop the locality groupssd_only, run:

GoogleSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="DROP LOCALITY GROUP ssd_only"

PostgreSQL

gcloudspannerdatabasesddlupdateexample-db\--instance=test-instance\--ddl="DROP LOCALITY GROUP ssd_only"

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.