|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Size restriction for primary key ?
I tried to create the below table in firebird database,
create table KD (H_ID integer not null,WORD varchar(200),URL_ID integer not null,WORDCOUNT integer,PRIMARY KEY(H_ID,WORD,URL_ID)); I get the following error, Statement failed, SQLCODE = -607 unsuccessful metadata update -key size too big for index RDB$PRIMARY77 Is there any size restriction for primary key in firebird? |
|
#2
|
||||
|
||||
|
Yes there are, see this basically for Firebird up to 1.5.2 is 252 bytes and for Firebird 2 is 1/4 of the page size, or a maximum of 4Kb.
Anyway I don't think that adding a varchar(200) to a primary key is a good idea.
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
|||
|
|||
|
Quote:
Yes, that's NOT VERY good idea... -- Best regards, Fikret Hasovic http://fikret.fbtalk.net USAID TAMP Senior Programmer * Firebird Foundation member. - Join today at http://www.firebirdsql.org/ff/foundation * JEDI VCS contributor http://jedivcs.sourceforge.net/ * Firebird and Fyracle news http://www.fyracle.org |
|
#4
|
||||
|
||||
|
Try creating the PRIMARY KEY on H_ID and after that create an INDEX on (H_ID,WORD,URL_ID)
![]()
__________________
If i've been helpful, please add to my reputation. My unfinished site: http://www.dever.ro |
|
#5
|
||||
|
||||
|
BTW: WORD must be NOT NULL to be part of a PK
|
|
#6
|
|||
|
|||
|
As you see below i also have problems with the index size.
Using UNICODE_FSS i get index size of 1612. I set Page (FB2) size to max 16384 but still get the error message "key size too big for index PK_FILEONVOLUME" Please help! --cut-- CREATE TABLE FILEONVOLUME ( VOLUMESERIAL VARCHAR(20) NOT NULL, MD5 VARCHAR(33) NOT NULL, RELATIVEPATH VARCHAR(200) NOT NULL, FILENAME VARCHAR(160) NOT NULL, EXTENSION VARCHAR(5) NOT NULL, FILELASTMODIFYTIME NUMERIC(18,0) NOT NULL, FILELASTACCESSTIME NUMERIC(18,0) NOT NULL, FILESIZE NUMERIC(18,0) NOT NULL, REC_VERSION_MODIFIED NUMERIC(18,0), REC_DATE_MODIFIED DOUBLE PRECISION); ALTER TABLE FILEONVOLUME ADD CONSTRAINT PK_FILEONVOLUME PRIMARY KEY (MD5, VOLUMESERIAL, RELATIVEPATH, FILENAME, EXTENSION); |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Size restriction for primary key ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|