ERROR: Cannot create ScaNN index with empty table. Once the table is populated
with data, create the index. See documentation to bypass this validation.
ERROR: Cannot create ScaNN index on parent partition table. Create ScaNN
indexes on the child tables instead. See documentation to bypass this
validation.
[[["易于理解","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-03。"],[],[],null,["Select a documentation version: 16.8.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/ai/troubleshoot-scann-indexes)\n- [16.8.0](/alloydb/omni/16.8.0/docs/ai/troubleshoot-scann-indexes)\n- [16.3.0](/alloydb/omni/16.3.0/docs/ai/troubleshoot-scann-indexes)\n- [15.12.0](/alloydb/omni/15.12.0/docs/ai/troubleshoot-scann-indexes)\n- [15.7.1](/alloydb/omni/15.7.1/docs/ai/troubleshoot-scann-indexes)\n- [15.7.0](/alloydb/omni/15.7.0/docs/ai/troubleshoot-scann-indexes)\n\n\u003cbr /\u003e\n\nThis document describes errors you might encounter when you generate a `ScaNN` index. Examples of errors and recommended fixes are also provided.\n\n\u003cbr /\u003e\n\nList of errors\n\nThe following a list of errors that are generated when you try to create a\n`ScaNN` index. You can disable generation of these errors and continue to generate\nthe index. For more information, see [Enforce index creation and suppress errors](#enforce-index-creation).\n\nERROR: Cannot create ScaNN index with empty table\n\nError message\n\nWhen you try to generate an index on a table with no data or try to truncate a\ntable with a `ScaNN` index generated on it, the following error occurs:\n\n`ERROR: Cannot create ScaNN index with empty table. Once the table is populated\nwith data, create the index. See documentation to bypass this validation.`\n\nSample queries that cause the error\n\n- Query Example A\n\n create table t1 (a INT, b VECTOR(512));\n CREATE TABLE\n create index on t1 using ScaNN(b cosine) with (num_leaves = 10, quantizer = 'sq8');\n\n- Query Example B\n\n truncate t1;\n\nRecommended fix\n\nMake sure that your table is populated with embedding vectors before you generate a `ScaNN` index.\n\nERROR: Cannot create ScaNN index\n\nError message\n\nWhen you try to generate an index on a table with few rows populated, the\nfollowing error occurs:\n\n`Cannot create ScaNN index, error: INVALID_ARGUMENT: Number of row (5) must be\nlarger than (1000).`\n\nSample query that causes the error \n\n create table t1 (a INT, b VECTOR(512));\n CREATE TABLE\n insert into t1 select (random()*1e9)::int, random_vector(512) from generate_series(1, 5);\n INSERT 0 5\n create index on t1 using scann(b cosine) with (num_leaves = 100, quantizer = 'sq8');\n\nRecommended fix\n\nEnsure that your table is populated with embedding vectors before you generate a\n`ScaNN` index. We recommend that the number of rows in the table are greater\nthan the value defined in the `num_leaves` parameter.\n\nERROR: Cannot create ScaNN index on parent partition table.\n\nError message\n\nIf you have created partitioned tables from a parent table, then creating a\nScaNN index on the parent table generates the following error:\n\n`ERROR: Cannot create ScaNN index on parent partition table. Create ScaNN\nindexes on the child tables instead. See documentation to bypass this\nvalidation.`\n\nSample query that causes the error \n\n create table t1 (a INT, b VECTOR(512)) partition by range(a);\n CREATE TABLE\n CREATE TABLE t1_one_ten PARTITION of t1 for values from (1) to (10);\n CREATE TABLE\n insert into t1_one_ten select (random()*1e9)::int, random_vector(512) from generate_series(1, 100);\n INSERT 0 100\n CREATE TABLE t1_eleven_twenty PARTITION of t1 for values from (11) to (20);\n CREATE TABLE\n insert into t1_eleven_twenty select (random()*1e9)::int, random_vector(512) from generate_series(1, 100);\n INSERT 0 100\n create index on t1 using scann(b cosine) with (num_leaves = 10, quantizer = 'sq8');\n\nRecommended fix\n\nYou can't generate a `ScaNN` index on the parent table of a partitioned table.\nYou must generate the `ScaNN` indexes on the partitioned table.\n\nEnforce index creation and suppress errors\n\nYou can enforce AlloyDB to generate an index and suppress errors. Before\nallowing index generation with this method, consider the following implications:\n\n- Since the index is trained on less or no data, centroids learn on zero data leading to bad recall.\n- The write performance to the database might also be slow.\n\nTo force index generation, complete the following:\n\n1. Set the `scann.allow_blocked_operations creation` session-level parameter\n to `true` on the database:\n\n SET scann.allow_blocked_operations = true;\n\n2. Assign the `SUPERUSER` privilege to the user that will run these queries on the database:\n\n CREATE USER \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSER_NAME\u003c/span\u003e\u003c/var\u003e WITH SUPERUSER PASSWORD \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePASSWORD\u003c/span\u003e\u003c/var\u003e;\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eUSER_NAME\u003c/var\u003e: the name of the user you want to grant the privilege to.\n - \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: the password of the user."]]