Create and manage tables

This page explains how to create and perform operations on Bigtabletables using the Google Cloud console, the Google Cloud CLI, or thecbt CLI.

Thecbt CLI supports several commands that are not described on thispage. For a complete list of commands, see thecbt reference.

You can also create and manage tables programmatically with theCloud Bigtableclient libraries orservice APIs.

For instructions about creating and managing authorized views of a table, seeauthorized views.

Before you begin

If you plan to work with your tables using command-line tools, follow the stepsin this section.

  1. Install thegcloud CLI.

  2. Optional: If you plan to use thecbt CLI, follow the instructions atInstalling thecbt CLI,including the step to create a.cbtrc file.

    Thecbt CLI instructions on this page assume that you have set the projectID and instance ID in your.cbtrc file. Alternatively, you can use the-project and-instance flags to set these values each time you run acbt CLI command.

Create a table

When you create a table, you don't need to specify the column families to usein the table. You can add or delete column families later.

Console

To create a new table in an instance:

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

  4. Enter a table ID for the table.

  5. Add column families (optional).

    You can add columns now or later. A table must have at least one columnfamily before you can write data to it. A table must have at least onecolumn family before you can write data to it or read a change streamfrom it.

  6. Optional: Enable a change stream for the table. Before you enable achange stream, make sure that you understand the implications, includingincreased storage costs and app profile usage requirements. To reviewthese details, see theOverview of change streams.

    1. SelectEnable change stream.

    2. In theExpiration time field, enter a number from 1 to 7 tospecify the number of days that the change stream data should beretained.

    3. ClickCreate.

  7. Optional: If you don't want Bigtable to create a dailybackup of the table, clear the checkbox next toEnable automatedbackup. For more information, seeUse automatedbackup.

  8. ClickCreate a table.

gcloud

To create a table, run the following command. Seegcloud bigtable instances tables createfor a complete list of options.

gcloudbigtableinstancestablescreateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--column-families=COLUMN-FAMILIES

Replace the following:

  • TABLE_ID: a unique ID for the new table
  • INSTANCE_ID: the ID of the instance
  • PROJECT_ID: the project that will contain the new table
  • COLUMN-FAMILIES: a comma-separated list of column family names. You can add more column families later.

Optional:

  • To protect the table from deletion, append the command with--deletion-protection. If you don't apply this setting, the tablecan be deleted. You can also explicitly allow table deletion byappending--no-deletion-protection.

  • To enable a change stream for the table, specify a retention period forthe change stream data. Before you enable a change stream, make surethat you understand the implications, including increased storage costsand app profile usage requirements. To review these details, see theOverview of change streams.

    --change-stream-retention-period=RETENTION_PERIOD

    ReplaceRETENTION_PERIOD with the length of time thatBigtable should retain change stream data for the table.The time must be from one to seven days. Acceptable units are days (d),hours (h), minutes (m), and seconds (s). Examples:48h or6d

  • To let Bigtable create a daily backup of your table andretain each backup for the default retention period ofseven days, use the--enable-automated-backup flag when you create your table.

    gcloudbigtableinstancestablescreateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--column-families=COLUMN-FAMILIES\--enable-automated-backup

    To configure a different retention period, use the--automated-backup-retention-period flag instead of the--enable-automated-backup flag and provide a value up to90 days, expressed as a number with a unit ofm,h, ord (minutes, hours, or days), such as15d for 15 days.

  • To enable infrequent access as part oftiered storage(Preview), use the
    --tiered-storage-infrequent-access-older-than flag and replaceAGE_THRESHOLD with a value of at least 30 days. Acceptableunits are days (d), hours (h), minutes (m), and seconds (s).Example:32d or32d12h.

    gcloudbetabigtableinstancestablescreateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--tiered-storage-infrequent-access-older-than=AGE_THRESHOLD

cbt

Use the following command, replacingTABLE_NAME with thename of your table. You can't use thecbt CLI to create a tablewith a change stream enabled.

cbt createtableTABLE_ID

Optional: To create anaggregate columnfamily in the table,append the column family name with the aggregation type. The followingcreates an aggregate column family with a garbagecollection policy ofnever.

cbt createtableTABLE_ID families=FAMILY_NAME:never:TYPE

Replace the following:

  • TABLE_ID: a unique ID for the new table
  • FAMILY_NAME: : a comma-separated list of column family names. You can add more column families later.
  • TYPE: the aggregate type. Must beintsum,intmin,intmax,orinthll.

For more options, seeCreate atable in thecbt CLIreference.

If you have mistakenly deleted a table, don't attempt to manually create thedeleted table. Use the gcloud CLIcommandbigtable instances tables undelete to recover thetable.

Optional: Split the table by row key

Key Point: You can specify table splits only when creating a new table, andthose specified splits remain for about 24 hours.

To optimize performance, Bigtable continuously splits tablesacross multiple nodes, evenly distributing the amount of data stored on eachnode, and keeping frequently accessed rows spread apart where possible. Thisongoing process is automatic.

When you create a new table, you can specify initial table splits.Bigtable splits the table at the row keys that you provide. If thekey spaces are too big, Bigtable further splits the table. Theinitial splits are maintained for about 24 hours after the table creation iscomplete. You can provide up to 100 row keys where the initial splits shouldoccur.

For example, you might designate specific rows to pre-split your table ifyou're about to write many rows to the table.

Pre-splitting your table is not essential, but it is beneficial because itprovides Bigtable information about where the load and datafootprint are likely to land when the table is created. The pre-split preventsBigtable from having to split the tables and rebalance the loadall at once as the data arrives.

Console

You are not able to pre-split the rows when you create a table using theGoogle Cloud console.

gcloud

To split a table by row key, run the following command. Seegcloud bigtable instances tables createfor a complete list of options.

gcloudbigtableinstancestablescreateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--column-families=COLUMN-FAMILIES\--splits=SPLITS

Replace the following:

  • TABLE_ID: a unique ID for the new table
  • INSTANCE_ID: the ID of the instance
  • PROJECT_ID: the project that will contain the new table
  • COLUMN-FAMILIES: a comma-separated list of column family names. You can add more column families later.
  • SPLITS: the row keys where the table should initially be split—for example,10,20.

cbt

To pre-split a table based on the row key, use the following syntax tocreate the table. Replace[TABLE_NAME] with the table name and[SPLITS]with a comma-separated list of row-key prefixes to use for the pre-splits.

```nonecbtcreatetable[TABLE_NAME]splits=[SPLITS]```

For example, to pre-split the tablemy-table at row keys that begin with10 and20:

```nonecbt createtable my-table splits=10,20```

Modify column families in a table

You can add column families in an existing table. If the table does not havedeletion protection enabled, then you can deletecolumn families in the table.

Add column families

Console

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

  4. ClickEdit for the tablethat you want to modify.

  5. For each column family that you want to add, complete the following:

    1. ClickAdd column family.
    2. Provide a unique identifier for the column family.
    3. Set the garbage collection policy for the columnfamily.
    4. ClickDone.
    5. ClickSave.

gcloud

You can't use the gcloud CLI to add column families to a table.

cbt

To add a column family to a table, use the following command:

cbt createfamilyTABLE_IDFAMILY_NAME

For example, to add the column familiescf1 andcf2 to the tablemy-table:

cbt createfamily my-table cf1cbt createfamily my-table cf2

Optional: To add anaggregate columnfamily to the table,append the column family name with the aggregation type. The followingcreates a table that has an aggregate column family with a garbage collectionpolicy ofnever.

cbt createfamilyTABLE_IDFAMILY_NAME:never:TYPE

Replace the following:

  • TABLE_ID: the table ID
  • FAMILY_NAME: : a comma-separated list of column familynames. You can add more column families later.
  • TYPE: the aggregation type. Must beintsum,intmin,intmax, orinthll.

Delete column families

You can delete column families in a table that does not havedeletion protection enabled.

Warning: When you delete a column family, you also delete the data storedin that column family. Deleting a column family can't be undone.

Console

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

  4. ClickEdit for the tablethat you want to modify.

  5. For each column family that you want to delete, complete the following:

    1. Mouse over the row for the column family that you want to delete.
    2. Click.
  6. ClickSave.

  7. To confirm that you understand that deleting a column family ispermanent and that all data in the column family will be deleted, type"Delete column families" in the text field.

  8. ClickConfirm.

gcloud

You can't use the gcloud CLI to delete column families from a table.

cbt

To delete a column family from a table, use the following command, replacing[TABLE_NAME] with the table name and[FAMILY_NAME] with the columnfamily name:

cbtdeletefamily[TABLE_NAME][FAMILY_NAME]

For example, to delete the column familycf2 from the tablemy-table:

cbt deletefamily my-table cf2

View a list of tables

Console

To view a list of tables in an instance:

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

    • Click the arrow next to the table IDto expand a list of replications of the table.
    • ClickView Metrics next to a table name toview system insights data for the table.

gcloud

To view a list of tables, run thegcloud bigtable instances tables listcommand.

gcloudbigtableinstancestableslist--instances=INSTANCE_IDS

Replace the following:

  • INSTANCE_IDS: a comma-separated list of instance IDs.

cbt

To view a list of tables in an instance, run the following command:

    cbt lsINSTANCE_ID

Replace the following:

  • INSTANCE_ID: The permanent identifier for the instance.

C++

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

namespacecbt=::google::cloud::bigtable;namespacecbta=::google::cloud::bigtable_admin;using::google::cloud::StreamRange;[](cbta::BigtableTableAdminClientadmin,std::stringconst&project_id,std::stringconst&instance_id){std::stringinstance_name=cbt::InstanceName(project_id,instance_id);google::bigtable::admin::v2::ListTablesRequestr;r.set_parent(instance_name);r.set_view(google::bigtable::admin::v2::Table::NAME_ONLY);StreamRange<google::bigtable::admin::v2::Table>tables=admin.ListTables(std::move(r));for(auto&table:tables){if(!table)throwstd::move(table).status();std::cout <<table->name() <<"\n";}}

C#

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

// Lists tables in intance.// Initialize request argument(s).ListTablesRequestrequest=newListTablesRequest{ParentAsInstanceName=s_instanceName};try{// Make the request.PagedEnumerable<ListTablesResponse,Table>response=bigtableTableAdminClient.ListTables(request);}catch(Exceptionex){Console.WriteLine($"Error listing tables {ex.Message}");}

Java

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

// Lists tables in the current instance.try{List<String>tableIds=adminClient.listTables();for(StringtableId:tableIds){System.out.println(tableId);}}catch(NotFoundExceptione){System.err.println("Failed to list tables from a non-existent instance: "+e.getMessage());}

Node.js

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

// List tables in current projectconst[tables]=awaitadminClient.listTables({parent:instance.name});tables.forEach(table=>{console.log(table.name);});

PHP

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

use Google\Cloud\Bigtable\Admin\V2\Client\BigtableInstanceAdminClient;use Google\Cloud\Bigtable\Admin\V2\Client\BigtableTableAdminClient;use Google\Cloud\Bigtable\Admin\V2\ListTablesRequest;/** * List tables in an instance * * @param string $projectId The Google Cloud project ID * @param string $instanceId The ID of the Bigtable instance */function list_tables(    string $projectId,    string $instanceId): void {    $instanceAdminClient = new BigtableInstanceAdminClient();    $tableAdminClient = new BigtableTableAdminClient();    $instanceName = $instanceAdminClient->instanceName($projectId, $instanceId);    printf('Listing Tables:' . PHP_EOL);    $listTablesRequest = (new ListTablesRequest())        ->setParent($instanceName);    $tables = $tableAdminClient->listTables($listTablesRequest)->iterateAllElements();    $tables = iterator_to_array($tables);    if (empty($tables)) {        print('No table exists.' . PHP_EOL);        return;    }    foreach ($tables as $table) {        print($table->getName() . PHP_EOL);    }}

Python

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

tables=instance.list_tables()print("Listing tables in current project...")iftables!=[]:fortblintables:print(tbl.table_id)else:print("No table exists in current project...")

Ruby

To learn how to install and use the client library for Bigtable, seeBigtable client libraries.

To authenticate to Bigtable, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# instance_id = "my-instance"bigtable.tables(instance_id).all.eachdo|t|puts"Table:#{t.name}"end

View information about a table

Console

To view information about a table:

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance. For eachtable, the Google Cloud console displays the number of clusters thatthe table is stored on, the table's status, storage utilization, and theidentifiers for any current backups of the table.

  4. To view column family names for the table, click. To close theEdit tablepane, clickCancel.

  5. To view additional details about the table, including table-levelmetrics and replication state, click the name of the table.

gcloud

To view information about a table, run thegcloud bigtable instances tables describecommand.

gcloudbigtableinstancestablesdescribeTABLE_ID\--instance=INSTANCE_ID

Replace the following:

  • TABLE_ID: a unique ID of the table
  • INSTANCE_ID: the ID of the instance

cbt

You can use thecbt CLI to get a list of existing column familiesin a table.

Use the following command, replacing[TABLE_NAME] with the table name:

cbtls[TABLE_NAME]

Set garbage collection policies

Agarbage collection policy tells Bigtable which datato keep and which data to mark for deletion. Garbage collection policies are setat the column family level. You can set them when you create the table or later.

When you create a column family, you can specify the number of cells thatyou want to retain in every column in that column family.If you do notspecify this setting, Bigtable uses one of the following defaultsettings:

  • If you create the column family with the Cloud Bigtable HBase client forJava or the HBase shell, or another tool that uses the HBase client for Java,Bigtable retains only 1 cell for each row or column intersection inthe column family. This default setting is consistent with HBase.

  • If you create the column family using the Google Cloud console, any otherclient library or thecbt CLI, Bigtable retains an infinitenumber of cells in each column.

SeeConfigure garbage collection policies for detailedinstructions on how to view, set, and update garbage collection policies.

Back up and restore a table

For instructions on how to back up a table and restore from a backup to a newtable, seeManage backups.

If you have enabled automated backup while creating a table, then you can modifyautomated backup configuration for a table to enable or disable automatedbackup, or change the retention period to up to90 days from the backup creation time. For moreinformation, seeUse automated backup.

Enable, disable, or configure a change stream

For instructions on the following tasks, seeConfigure a change stream.

  • Enabling a change stream on an existing table
  • Disabling a change stream
  • Update the retention period for a change stream

Delete a table

Deleting a table also deletes all authorized views of the table. If anyauthorized views of the table have deletion protection enabled, you can'tdelete the table. You also can't delete a table that has a continuousmaterialized view based on it.

Warning: When you delete a table, you also delete the data stored in thattable.

Console

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

  4. Click for the table thatyou want to delete.

  5. ClickDelete.

  6. To confirm that you acknowledge that this action will delete the tablefrom all clusters in the instance and that you have only seven days toundelete the table, type the table ID in theDelete table box.

  7. ClickDelete.

gcloud

  1. To delete tables, run thegcloud bigtable instances tables deletecommand.

    gcloudbigtableinstancestablesdeleteTABLE_ID--instance=INSTANCE_ID

    Replace the following:

    • TABLE_ID: the unique ID of the table
    • INSTANCE_ID: the ID of the instance
  2. In the terminal, entery to confirm table deletion.

cbt

To delete a table, use the following command, replacing[TABLE_NAME] withthe table name:

cbtdeletetable[TABLE_NAME]

Undelete a table

If you accidentally delete a table, you can use the gcloud CLIcommandbigtable instances tables undelete toundelete,or recover, the table. Don't attempt to recreate the deleted table manually.

To undelete a table, run the following command in the terminal:

gcloudbigtableinstancestablesundeleteTABLE_ID--instance=INSTANCE_ID

Replace the following:

  • TABLE_ID: the unique identifier for the table
  • INSTANCE_ID: the ID of the instance

When you undelete a table, Bigtable enables deletion protection for thetable automatically.

The following limitations apply:

  • The ability to undelete a table is available forapproximately seven daysfrom the time of table deletion.
  • You can't undelete a table by using the Google Cloud console, theCloud Bigtable client libraries, or thecbt CLI.
  • You can't undelete a table from an instance that was deleted.
  • You can't undelete a table that had CMEK enabled.
  • When you undelete a table, Bigtable doesn't restore anyfine-grained IAM policy bindings to the deleted table.

You can optionally check the status of theundelete operation in theaudit logs.

Modify deletion protection

You can enable or disable deletion protection for a table if you are a principalin a role that includes thebigtable.tables.update permission, such asroles/bigtable.admin. Deletion protection prevents the deletion of the table,all column families in the table, and the instance that contains the table.

Enabling deletion protection for a table does not enable it forauthorized views of the table. Similarly, disabling a table's deletionprotection does not disable it for authorized views of the table. You mustupdate the table's authorized viewsseparately.

Console

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance whose tables you want to view.

  3. ClickTables in the left pane.

    TheTables page displays a list of tables in the instance.

  4. Click next to the tableID.

  5. To enable deletion protection, clickPrevent deletion. To disabledeletion protection, clickEnable deletion. Only the valid option isvisible.

gcloud

To enable deletion protection for a table, run thegcloud bigtable instancestable update command:

```shgcloud bigtable instances tables updateTABLE_ID \    --instance=INSTANCE_ID \    --deletion-protection```

To disable deletion protection for a table, run the following:

```shgcloud bigtable instances tables updateTABLE_ID \    --instance=INSTANCE_ID \    --no-deletion-protection```

Replace the following:

+TABLE_ID: the unique identifier for the table+INSTANCE_ID: the ID of the instance

cbt

You are not able to use thecbt CLI to enable or disable deletionprotection.

Modify the age threshold of infrequent access storage

Preview

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

To modify the age threshold of infrequent access storage, run thegcloud beta bigtable instances tables updatecommand with the--tiered-storage-infrequent-access-older-than flag:

gcloud

gcloudbetabigtableinstancestablesupdateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--tiered-storage-infrequent-access-older-than=AGE_THRESHOLD

Replace the following:

  • TABLE_ID: the ID for the table that you want to update.
  • INSTANCE_ID: the ID of the instance.
  • PROJECT_ID: the project that contains the table thatyou want to update.
  • AGE_THRESHOLD: the age threshold, which must be atleast 30 days. Acceptable units are days (d), hours (h), minutes(m), and seconds (s). Example: from32d previously to33d.

Disable infrequent access storage

Preview

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

You can disable infrequent access storage at any time. As a result,Bigtable moves all data in infrequent access storage to SSDstorage. Before you disable infrequent access storage, make sure that youunderstand thecost implications.

To disable infrequent access storage, use thegcloud beta bigtable instances tables updatecommand with the--clear-tiered-storage-config flag:

gcloud

gcloudbetabigtableinstancestablesupdateTABLE_ID\--instance=INSTANCE_ID\--project=PROJECT_ID\--clear-tiered-storage-config

Replace the following:

  • TABLE_ID: the ID for the table that you want to update
  • INSTANCE_ID: the ID of the instance
  • PROJECT_ID: the project that contains the table thatyou want to update

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 2026-02-19 UTC.