burmair wrote:

I have a table with columns and constraint

x varchar(250)
y varchar(250)
z varchar(40)
UNIQUE (x, y, z)

The charset is UTF8, so the key length is (250+250+40)*3 = 1620

With a page size of 16384, no problem. With a page size of 8192, I get the following error

key size exceeds implementation restriction for index "RDB$3"

RDB$3 is the (x, y, z) constraint. According to the release notes (Firebird_v2.0.3.ReleaseNotes.pdf), the maximum key size should be 1/4 the page size. For 8192, this would be 2048. What am I missing?

Helen Borrie answers:

It's not a matter of just adding up the widths and comparing them with the limit. Composite indices take up more "width", as do multi-byte charsets and collations. In your example the total key size is 2700 bytes, so you need to adjust the widths of those varchars if you want a unique constraint on them with an 8K page size.

How do I know your key size? Visit Index Key Size Calculator.

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list