Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index char limit error [CORE5752] #6015

Closed
firebird-automations opened this issue Feb 18, 2018 · 6 comments
Closed

Index char limit error [CORE5752] #6015

firebird-automations opened this issue Feb 18, 2018 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Reydy Valentin (lifeoryou)

When I want to create a index with two varchar(205) in utf8, firebird give me a error (key size exceeds implementation restriction for index).
But according to the documentation, normally the limit is 509 from this compute : (PAGE_SIZE / 4 - 9) / BYTES_PER_CHARSET.
And for my is (8192 / 4 - 9) / 4 = 509 (Same the doc)

Exemple script for test this issue

-- Basic table
CREATE TABLE "table" (
"id" INTEGER NOT NULL,
"fname" VARCHAR(205) NOT NULL,
"lname" VARCHAR(205) NOT NULL,
"fname2" VARCHAR(204) NOT NULL,
"lname2" VARCHAR(204) NOT NULL
);

CREATE INDEX "idx_table_test1" ON "table" ("fname", "lname"); -- 410 : Fail
CREATE INDEX "idx_table_test2" ON "table" ("fname", "lname2"); -- 409 : Fail
CREATE INDEX "idx_table_test3" ON "table" ("fname2", "lname2"); -- 408 : Work

Why ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Because two fields of 205 characters does not produce the key of 410*4 bytes. For compound indices, special bytes are added per every segment, so the actual compound key is slightly longer than you expect.

@firebird-automations
Copy link
Collaborator Author

Commented by: Reydy Valentin (lifeoryou)

do you have a formula to prevent this ?

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

http://www.firebirdfaq.org/faq211/

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Reydy Valentin (lifeoryou)

Thank a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant