[[["易于理解","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,["# Manage column store content manually\n\nSelect a documentation version: 15.12.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/columnar-engine/manage-content-manually)\n- [16.8.0](/alloydb/omni/16.8.0/docs/columnar-engine/manage-content-manually)\n- [16.3.0](/alloydb/omni/16.3.0/docs/columnar-engine/manage-content-manually)\n- [15.12.0](/alloydb/omni/15.12.0/docs/columnar-engine/manage-content-manually)\n- [15.7.1](/alloydb/omni/15.7.1/docs/columnar-engine/manage-content-manually)\n- [15.7.0](/alloydb/omni/15.7.0/docs/columnar-engine/manage-content-manually)\n\n\u003cbr /\u003e\n\nThis page describes how to manage the content of the columnar engine's column store by manually adding and removing columns.\n\n\u003cbr /\u003e\n\nBased on your workload, you can manually add columns to the column store or drop\nsome or all of the columns of a table or a materialized view from the column\nstore. Query evaluation automatically uses the stored columnar data to answer\nqueries.\n\nWhen choosing which tables, materialized views and columns to add to the column store, consider both the size of the column store and the shape of the workload. Good candidates for selection include large tables or views that are frequently scanned. Within these tables or views,\nidentify any large non-unique indexes used by the OLAP workload. You can add\nthese indexes' columns to the column store and potentially drop the indexes,\nthereby eliminating the performance cost associated with their maintenance on\nthe primary instance.\n\nUse one of the following methods to manage the content of the columnar engine's\ncolumn store:\n\n- [Manage column store content by updating database flags](#manage-relations)\n- [Manage column store content using SQL functions](#manage-sql)\n\nSee [What data you can add to the column store](/alloydb/omni/15.12.0/docs/columnar-engine/overview#limitations) for information\nabout what data types and data sources you can use when adding tables, columns, and materialized views to the column store.\n\nManage column store content by updating database flags\n------------------------------------------------------\n\nYou can manage column store content manually by updating the\n`google_columnar_engine.relations` database flag. The flag has a single\nvalue that specifies all of your column store's data sources. During the\nrestart, columns specified in this flag are automatically populated into the\ncolumn store.\n\nYou can use this flag together with [auto-columnarization](/alloydb/omni/15.12.0/docs/columnar-engine/manage-content-recommendations). If the\ncolumnar engine has memory available after populating the columns you\nspecify through the `google_columnar_engine.relations` flag, then\nauto-columnarization adds further columns to the column store, as\nneeded.\n\n### Add columns using flags\n\nTo add columns to the column store, define an instance's\n`google_columnar_engine.relations` flag. Set its value to a comma-separated list\nof items, with each item specifying a list of columns to include from a specific\ntable, in this format: \n\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDATABASE_NAME\u003c/span\u003e\u003c/var\u003e.\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eSCHEMA_NAME\u003c/span\u003e\u003c/var\u003e.\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eTABLE_NAME\u003c/span\u003e\u003c/var\u003e(\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCOLUMN_LIST\u003c/span\u003e\u003c/var\u003e)\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e: the database containing the columns to add\n to the column store.\n\n- \u003cvar translate=\"no\"\u003eSCHEMA_NAME\u003c/var\u003e: the schema identifying the tables or the\n materialized views to add to the column store---for example, `public`.\n\n- \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e: the table or the materialized view containing\n the columns to add to the column store.\n\n- \u003cvar translate=\"no\"\u003eCOLUMN_LIST\u003c/var\u003e: a comma-separated list of the\n columns to add to the column store.\n\nTo add all of one table's or one materialized view's columns, omit the column\nlist: \n\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDATABASE_NAME\u003c/span\u003e\u003c/var\u003e.\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eSCHEMA_NAME\u003c/span\u003e\u003c/var\u003e.\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eTABLE_NAME\u003c/span\u003e\u003c/var\u003e\n\n**Caution:** Running this example unsets all database flags from the instance except for the flags that it specifies. \n\n ALTER SYSTEM SET google_columnar_engine.relations='\u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e.\u003cvar translate=\"no\"\u003eSCHEMA_NAME\u003c/var\u003e.\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e(\u003cvar translate=\"no\"\u003eCOLUMN_1\u003c/var\u003e,\u003cvar translate=\"no\"\u003eCOLUMN_2\u003c/var\u003e)';\n\n### Drop columns using flags\n\nTo drop columns from the column store, set a new value for the\n`google_columnar_engine.relations` flag described in [Add columns using flags](/alloydb/omni/15.12.0/docs/columnar-engine/manage-content-manually#by-flag),\nleaving out the columns that you want to drop.\n\nTo drop all of the columns from the column store, unset the\n`google_columnar_engine.relations` flag from your instance.\n\nFor more information on setting database flags on an instance, see [Configure AlloyDB Omni database parameters](/alloydb/omni/15.12.0/docs/configure-database-flags).\n\nManage column store content using SQL functions\n-----------------------------------------------\n\nYou can manage column store content manually by using SQL functions.\n\n### Add columns using SQL functions\n\nRun the `google_columnar_engine_add` SQL function to add columns\nto the column store.\n\nThis method adds the specified columns to the column store and manages the columns\nin the connected node only. The new columns don't persist within the store across\ninstance restarts.\n\nThis method does not change the\n[`google_columnar_engine.relations`](#manage-relations)\ndatabase flag. [Auto columnarization](/alloydb/omni/15.12.0/docs/columnar-engine/manage-content-recommendations)\ndoes not consider columns added by this SQL function. \n\n### psql Client\n\n```\nSELECT google_columnar_engine_add(\n relation =\u003e 'TABLE_NAME',\n columns =\u003e 'COLUMN_LIST'\n);\n```\n\nReplace the following:\n- '\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e': A string containing the name of the table or the materialized view. If the table or the view is in a schema other than `public`, specify the name of the schema, a dot, and the name of the table or the view; for example, `'myschema.mytable'`.\n- '\u003cvar translate=\"no\"\u003eCOLUMN_LIST\u003c/var\u003e': A string containing a comma-separated, case-sensitive list of the names of the columns you want to add. If you want to add all of the table's or the materialized view's columns to the column store, omit this parameter.\n\n### Drop columns using SQL functions\n\nRun the `google_columnar_engine_drop` SQL function as follows: \n\n### psql Client\n\n```\nSELECT google_columnar_engine_drop(\n relation =\u003e 'TABLE_NAME',\n columns =\u003e 'COLUMN_LIST'\n);\n```\nReplace the following:\n\n- '\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e': A string containing the name of the table or the materialized view. If the table or the view is in a schema other than `public`, specify the name of the schema, a dot, and the name of the table or the view; for example, `'myschema.mytable'`.\n- '\u003cvar translate=\"no\"\u003eCOLUMN_LIST\u003c/var\u003e': A string containing a comma-separated, case-sensitive list of the names of the columns you want to add. If you want to add all of the table's or the materialized view's columns to the column store, omit this parameter.\n\nYou can use the `google_columnar_engine_drop` function to remove columns added\nby editing the `google_columnar_engine.relations` database flag. However, when\nyou do so, those columns are added back to the columnar store when the\ninstance is restarted."]]