[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# Configure Spanner columnar engine\n\n| **Preview\n| --- [Spanner columnar engine](/spanner/docs/columnar-engine)**\n|\n|\n| This 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 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|\n|\n| For information about access to this\n| release, see the\n| [access request page](https://forms.gle/nE1bAqfHJrqhkStR9).\n\n\n| **PostgreSQL interface note:** The examples in this topic are intended for GoogleSQL-dialect databases. This feature doesn't support PostgreSQL interface.\n\n\u003cbr /\u003e\n\nThis page describes how to enable Spanner columnar engine on a\ndatabase, table, or index, and accelerate file format generation.\n\nEnable Spanner columnar engine\n------------------------------\n\nSpanner columnar engine is enabled using a `SET OPTIONS` clause\nwith the `columnar_policy` option. You can apply this option when you create or\nalter `DATABASE`, `TABLE`, or `INDEX` schema objects. `SEARCH INDEX` and\n`VECTOR INDEX` schema objects are never in columnar format.\n\nLower levels in a database and table hierarchy inherit the `columnar_policy`\nfrom its parent. You can change this setting at lower levels.\n\nThe `columnar_policy` option has the following flags:\n\n- `'enabled'` or `'disabled'` turns the columnar engine on or off for the specific schema object.\n- `NULL` (default) uses the columnar engine policy from the parent object, if one exists. `NULL` clears previous settings on a table object.\n\nYou can also omit `OPTIONS` to inherit the `columnar_policy` from the parent\nobject.\n\nThe following example shows how to:\n\n- Create a database with the columnar policy enabled.\n- Define a `Singers` table that inherits the columnar policy from the database (omit the `columnar_policy = NULL` for the table option).\n- Define a `Concerts` table with the columnar policy explicitly disabled.\n\n CREATE DATABASE Music;\n\n ALTER DATABASE Music SET OPTIONS (columnar_policy = 'enabled');\n\n CREATE TABLE Singers(\n SingerId INT64 NOT NULL,\n FirstName STRING(1024),\n LastName STRING(1024),\n BirthDate DATE,\n Status STRING(1024),\n LastUpdated TIMESTAMP,)\n PRIMARY KEY(SingerId);\n\n CREATE TABLE Concerts(\n VenueId INT64 NOT NULL,\n SingerId INT64 NOT NULL,\n ConcertDate DATE NOT NULL,\n BeginTime TIMESTAMP,\n EndTime TIMESTAMP,)\n PRIMARY KEY(VenueId, SingerId, ConcertDate),\n OPTIONS (columnar_policy = 'disabled');\n\nYou can also use `ALTER TABLE` with the `SET OPTIONS` clause to enable or\ndisable the `columnar_policy` on a table. The following example shows how to\ndisable the policy in the `Singers` table: \n\n ALTER TABLE Singers SET OPTIONS (columnar_policy = 'disabled');\n\n| **Note:** Enabling Spanner columnar engine increases the storage usage of the target database or table (depending on the enabling option used). It's important to ensure that the Spanner instance has sufficient storage capacity to accommodate the increase in storage usage. For more information, see [Database limits](/spanner/quotas#database-limits).\n\nColumnar file format generation\n-------------------------------\n\nSpanner generates the columnar file format at compaction time.\nCompaction is a background process that typically is spread out over multiple\ndays, but it might happen sooner if the size of the database grows\nsubstantially. For more information, see [Optimal columnar coverage](/spanner/docs/columnar-engine#optimal_columnar_coverage).\n| **Note:** You can contact [spanner-columnar-preview@google.com](mailto:spanner-columnar-preview@google.com) to request accelerated generation of columnar format for existing data.\n\nWhat's next\n-----------\n\n- Learn about [columnar engine](/spanner/docs/columnar-engine).\n- Learn how to [query columnar data](/spanner/docs/query-columnar-data).\n- Learn how to [monitor columnar engine](/spanner/docs/monitor-columnar-engine)."]]