Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat dan mengelola tampilan terwujud berkelanjutan
Dokumen ini menjelaskan cara membuat dan melakukan operasi pada tampilan terwujud
berkelanjutan di Bigtable. Sebelum membaca dokumen ini, baca ringkasannya di Tampilan terwujud berkelanjutan.
Anda dapat membuat tampilan terwujud berkelanjutan menggunakan Google Cloud CLI, editor kueri Bigtable Studio di konsol Google Cloud , atau library klien Bigtable untuk Java dan Go.
Sebelum memulai
Lakukan langkah-langkah berikut jika Anda berencana menggunakan gcloud CLI.
Untuk mendapatkan izin yang diperlukan untuk membuat dan mengelola tampilan terwujud berkelanjutan, minta administrator untuk memberi Anda peran Bigtable Admin (roles/bigtable.admin) di instance.
Jika tidak, minta izin berikut di tingkat instance, bergantung pada
operasi yang ingin Anda lakukan:
Buat: bigtable.materializedViews.create
Update: bigtable.materializedViews.update
Hapus: bigtable.materializedViews.delete
Daftar: bigtable.materializedViews.list
Untuk membuat tampilan terwujud berkelanjutan, Anda juga harus memiliki setidaknya
izin bigtable.tables.readRows pada tabel sumber.
Sebelum membuat tampilan terwujud berkelanjutan, lakukan hal berikut:
Opsional: Sebagai praktik terbaik, aktifkan
penskalaan otomatis untuk cluster di instance Anda guna
memastikan cluster dapat di-scale up jika diperlukan saat Bigtable
memproses dan menyinkronkan tampilan terwujud berkelanjutan serta menangani
penggunaan penyimpanan tambahan.
Identifikasi tabel Bigtable yang izin membacanya Anda miliki untuk digunakan sebagai sumber tampilan terwujud berkelanjutan.
Setelah Anda membuat tampilan terwujud berkelanjutan, mungkin perlu waktu beberapa menit agar tampilan tersebut menjadi aktif dan dapat dikueri. Anda dapat melihat
metrik
untuk tampilan guna memantau progresnya.
Konsol
Buka daftar instance Bigtable di konsol Google Cloud .
VIEW: ID unik untuk
tampilan terwujud berkelanjutan. Anda menggunakan ID ini sebagai ID tabel saat
membuat kueri tampilan terwujud berkelanjutan.
INSTANCE: ID instance untuk membuat
tampilan terwujud berkelanjutan. Harus merupakan instance yang sama dengan
tabel sumber.
QUERY: pernyataan SQL yang valid yang menentukan
tampilan terwujud berkelanjutan.
Opsional: untuk mengaktifkan perlindungan penghapusan untuk tampilan terwujud berkelanjutan, tambahkan
perintah dengan berikut ini:
--deletion-protection=DELETION_PROTECTION
Ganti DELETION_PROTECTION dengan true atau
false.
Memperbarui tampilan terwujud berkelanjutan
Anda dapat memperbarui perlindungan penghapusan untuk tampilan terwujud berkelanjutan. Anda tidak dapat
memperbarui kueri SQL yang menentukan tampilan terwujud berkelanjutan; jika Anda perlu
mengubah kueri, Anda harus menghapus tampilan terwujud berkelanjutan, lalu
membuat yang baru yang menyertakan perubahan Anda.
Konsol
Anda tidak dapat memperbarui tampilan terwujud berkelanjutan di konsol.
Sebagai gantinya, gunakan gcloud CLI.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-27 UTC."],[],[],null,["# Create and manage continuous materialized views\n===============================================\n\n|\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----------------\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\n### Required 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-------------------------------------\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\n### Console\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\n### gcloud\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-------------------------------------\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\n### Console\n\nYou can't update a continuous materialized view in the console.\nUse the gcloud CLI instead.\n\n### gcloud\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-------------------------------------\n\nYou can delete a continuous materialized view that doesn't have deletion protection\nenabled. You can't undo this operation. \n\n### Console\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\n### gcloud\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-------------------------------------------\n\nYou can see a list of continuous materialized views for an instance. \n\n### Console\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\n### gcloud\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\n- [Continuous materialized view queries](/bigtable/docs/continuous-materialized-view-queries)\n- [Tables and views](/bigtable/docs/tables-and-views)"]]