Quantcast
Viewing all articles
Browse latest Browse all 11593

Re: MS SQL Warnings - The maximum key length is 900 bytes. (Bug: Openfire 3.x.x)

its unlikely this warning will cause an issue, but it looks like to fix it you would change the tables

 

CREATE TABLE ofRoster (

  rosterID              INTEGER         NOT NULL,

  username              NVARCHAR(64)    NOT NULL,

  jid                   NVARCHAR(1024)  NOT NULL,

  sub                   INTEGER         NOT NULL,

  ask                   INTEGER         NOT NULL,

  recv                  INTEGER         NOT NULL,

  nick                  NVARCHAR(255),

  CONSTRAINT ofRoster_pk PRIMARY KEY (rosterID)

);

CREATE INDEX ofRoster_username_idx ON ofRoster (username ASC);

CREATE INDEX ofRoster_jid_idx ON ofRoster (jid ASC);

 

This tells us an entry a JID to be 1024 character saved in unicode (2 bytes per character)  causing the size to be 2048. Since is unlikely anyone will have a jid that size, you could change this value down to something like 448.  Then when the index is created using the jid, it will be under 900 bytes

 

Same theory goes for the

CREATE TABLE ofSASLAuthorized (

  username        NVARCHAR(64)     NOT NULL,

  principal       NVARCHAR(2000)   NOT NULL,

  CONSTRAINT ofSASLAuthorized_pk PRIMARY KEY (username, principal)

 

This primary key is created by using the both the username and principal.  Again, its unlikely that the principal will be 2000 characters, so you could set this to something like 320.

another option may be to use the INCLUDE

for example..

 

CONSTRAINT ofSASLAuthorized_pk PRIMARY KEY (username)

INCLUDE(principal)

 

 

I haven't test any of this..so use at your own risk!!


Viewing all articles
Browse latest Browse all 11593

Trending Articles