[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["Create and manage continuous materialized views\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis document describes how to create and perform operations on a continuous\nmaterialized view in Bigtable. Before you read this document, read the\noverview at [Continuous materialized views](/bigtable/docs/materialized-views).\n\nYou can create a continuous materialized view using the Google Cloud CLI, the\nBigtable Studio query editor in the Google Cloud console, or the\nBigtable client libraries for Java and Go.\n\nBefore you begin\n\nTake the following steps if you plan to use the gcloud CLI.\n\n1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n2. If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n3.\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n | **Note:** You can run the gcloud CLI in the Google Cloud console without installing the Google Cloud CLI. To run the gcloud CLI in the Google Cloud console, [use\n | Cloud Shell](https://console.cloud.google.com/?cloudshell=true).\n\n\u003cbr /\u003e\n\n| **Note:** If the gcloud CLI returns a `Method not found` message, run the [`gcloud auth login`](/sdk/gcloud/reference/auth/login) command again.\n\nRequired roles\n\nTo get the permissions that you need to create and manage continuous\nmaterialized views, ask your administrator to grant you the\nBigtable Admin (`roles/bigtable.admin`) role on the instance.\nOtherwise, ask for the following permissions at the instance level, depending on\nthe operation that you want to perform:\n\n- Create: `bigtable.materializedViews.create`\n- Update: `bigtable.materializedViews.update`\n- Delete: `bigtable.materializedViews.delete`\n- List: `bigtable.materializedViews.list`\n\nTo create a continuous materialized view, you must also have at least\n`bigtable.tables.readRows` permission on the source table.\n\nTo see all available roles and permissions, see\n[Bigtable access control with IAM](/bigtable/docs/access-control).\n\nCreate a continuous materialized view\n\nBefore you create a continuous materialized view, do the following:\n\n- Optional: As a best practice, enable [autoscaling](/bigtable/docs/autoscaling) for clusters in your instance to make sure they can scale up if necessary while Bigtable processes and synchronizes the continuous materialized view and to handle any additional [storage usage](/bigtable/docs/continuous%0Amaterialized-views#storage).\n- Identify a Bigtable table that you have permission to read to use as the source for the continuous materialized view.\n- Prepare the SQL query that defines your continuous materialized view. For query requirements, see [Continuous materialized view\n queries](/bigtable/docs/continuous-materialized-view-queries).\n\nAfter you create a continuous materialized view, it might take a few minutes to\nbecome active and queryable. You can look at\n[metrics](/bigtable/docs/continuous-materialized-views#metrics)\nfor the view to monitor its progress. \n\nConsole\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Select an instance.\n\n3. In the navigation pane, click **Bigtable Studio**.\n\n4. Open a new tab by clicking add and\n then choosing **Editor**.\n\n 1. When the query editor appears, write your query. If the query is\n valid SQL, a **Valid** message is displayed.\n\n 2. Optional: To format your statement in SQL style, click **Format**.\n\n 3. Click **Run** . The results of your query appear in the **Results** table.\n\n 4. When you're satisfied with the query, click **Save** and then choose\n **Materialized view**.\n\n For more information about using the query editor, see [Manage your\n data using Bigtable\n Studio](/bigtable/docs/manage-data-using-console).\n\ngcloud\n\nTo create a continuous materialized view, use the\n[`gcloud beta bigtable materialized-views create`](/sdk/gcloud/reference/beta/bigtable/materialized-views/create)\ncommand: \n\n gcloud beta bigtable materialized-views create \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e \\\n --instance=\u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e --query=\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e: a unique identifier for the continuous materialized view. You use this ID as the table ID when querying the continuous materialized view.\n- \u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e: the identifier of the instance to create the continuous materialized view in. Must be the same instance as the source table.\n- \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: a valid SQL statement that defines the continuous materialized view.\n\nOptional: to enable deletion protection for the continuous materialized view, append the\ncommand with the following: \n\n --deletion-protection=\u003cvar translate=\"no\"\u003eDELETION_PROTECTION\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eDELETION_PROTECTION\u003c/var\u003e with either `true` or\n`false`.\n\nUpdate a continuous materialized view\n\nYou can update deletion protection for a continuous materialized view. You can't\nupdate the SQL query that defines a continuous materialized view; if you need to\nmodify the query, you must delete the continuous materialized view and then\ncreate a new one that includes your changes. \n\nConsole\n\nYou can't update a continuous materialized view in the console.\nUse the gcloud CLI instead.\n\ngcloud\n\nTo enable or disable deletion protection for a continuous materialized view, use\nthe [`gcloud beta bigtable materialized-views update command`](/sdk/gcloud/reference/beta/bigtable/materialized-views/update) command. \n\n gcloud beta bigtable materialized-views update \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e \\\n ---instance=\u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e --deletion-protection=\u003cvar translate=\"no\"\u003eDELETION_PROTECTION\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e: the unique identifier for the continuous materialized view that you want to update\n- \u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e: the identifier of the instance containing the continuous materialized view\n- \u003cvar translate=\"no\"\u003eDELETION_PROTECTION\u003c/var\u003e: either `true` or `false`\n\nDelete a continuous materialized view\n\nYou can delete a continuous materialized view that doesn't have deletion protection\nenabled. You can't undo this operation. \n\nConsole\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Select an instance from the list.\n\n3. In the navigation pane, click **Bigtable Studio**.\n\n4. Expand **Materialized views**.\n\n5. Next to the view that you want to delete, click the\n more_vert action menu,\n and then click **Delete**.\n\ngcloud\n\nTo delete a continuous materialized view, use the\n[`gcloud beta bigtable materialized-views delete`](/sdk/gcloud/reference/beta/bigtable/materialized-views/delete)\ncommand: \n\n gcloud beta bigtable materialized-views delete \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e \\\n --instance=\u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVIEW\u003c/var\u003e: the unique identifier for the continuous materialized view that you want to delete\n- \u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e: the identifier of the instance containing the continuous materialized view\n\nGet a list of continuous materialized views\n\nYou can see a list of continuous materialized views for an instance. \n\nConsole\n\n1.\n Open the list of Bigtable instances in the Google Cloud console.\n\n\n [Open the instance list](https://console.cloud.google.com/bigtable/instances)\n2. Select an instance from the list.\n\n3. In the navigation pane, click **Bigtable Studio.** A list of\n continuous materialized views is displayed.\n\n4. Optional: The first 10 views in the instance are listed. To see 10 more,\n click **Show more**.\n\ngcloud\n\nTo list all continuous materialized views for an instance, use the\n[`gcloud bigtable materialized-views list`](/sdk/gcloud/reference/beta/bigtable/materialized-views/list) command. \n\n gcloud bigtable materialized-views list --instance=\u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eINSTANCE\u003c/var\u003e with the instance ID.\n\nWhat's next\n\n- [Continuous materialized view queries](/bigtable/docs/continuous-materialized-view-queries)\n- [Tables and views](/bigtable/docs/tables-and-views)"]]