The index 'UQ_Transact_396D246F48ECC9B6' has maximum length of 1024 bytes
And how is that index defined? Does it may have the column "fileSpec" = 1.024 bytes length?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
got the message
Warning! The maximum key length is 900 bytes. The index 'UQ__Transact__396D246F48ECC9B6' has maximum length of 1024 bytes. For some combination of large values, the insert/update operation will fail.
On trying to create a table:
>
CREATE TABLE "dbO"."Transaction_doc" (
"tx_doc_Id" bigint NOT NULL UNIQUE,--DEFAULT AUTOINCREMENT,
"subAcct_ID" INTEGER NULL,
"acct_id" INTEGER NULL,
"Count" SMALLINT NOT NULL DEFAULT 1,
"processed" SMALLINT NOT NULL DEFAULT 0,
"fileSpec" VARCHAR(1024) NOT NULL UNIQUE,
"Updated" TIMESTAMP NULL,
"Updated_By" VARCHAR(30) NULL,
CONSTRAINT "PK_Transaction_Doc_tx_doc_id" PRIMARY KEY ( "tx_doc_Id" ASC )
)
what have I done to trigger the message?
PS I thought bigint is only 8 bytes and Sqlanywhere does not have trouble with this.)
The index 'UQ_Transact_396D246F48ECC9B6' has maximum length of 1024 bytes
And how is that index defined? Does it may have the column "fileSpec" = 1.024 bytes length?
Please refer to:
I also found a similar problem. Someone gave a solution to index large columns:
Warning! The maximum key length is 900 bytes. The index has maximum length of 1000 bytes
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Before SQL 16 the maximum combined length of the columns in an index was 900 bytes. With SQL 2016, that is still the maximum length for clustered indexes, but the maximum length for nonclustered indexes is 1700 bytes. Since the unique index you defined on filespec would be a nonclustered index, you should be fine with SQL 2016 or later.
Also, you don't want to make tx_doc_id the primary key and also declare it to be unique. Doing that will create two indexes on tx_doc_id (one clustered and one nonclustered). So you want to remove the UNIQUE attribute from tx_doc_id. Since it is the only key in your primary key constraint, it is already forced to be unique.
Tom