Subject Re: Frequntly "index page error"
Author mnavahan
--- In firebird-support@yahoogroups.com, "mnavahan" <mnavahan@...> wrote:
>
> --- In firebird-support@yahoogroups.com, Helen Borrie <helebor@> wrote:
> >
> > At 11:55 AM 7/05/2009, you wrote:
> >
> > >have any way database not working if free memory not over 25% ?
> >
> > I don't understand the question...
> >
> > If you have "free memory", it has nothing to do with whether the database is working or not. Assuming you have Classic processes running (= users connected) then each process will be doing some kind of work and using resources. Each process will use memory (sometimes a lot, sometimes a little) for many other things besides the page cache.
> >
> > ./heLen
> >
>
> Hi helen
>
> i gave sone recursive sp
> this sp(s) do really depth process (up to 4096 level !) and also use some temp table
> have firebird really power of do it ?
>
> thx
>


CREATE TABLE ACC$PREDOC (
NID DM_ID NOT NULL /* DM_ID = INTEGER */,
DOC_LINK DM_ID NOT NULL /* DM_ID = INTEGER */,
NAME DM_NAME_L2 NOT NULL /* DM_NAME_L2 = VARCHAR(50) */,
BED DM_MONEY_BIG DEFAULT 0 /* DM_MONEY_BIG = BIGINT */,
BES DM_MONEY_BIG DEFAULT 0 /* DM_MONEY_BIG = BIGINT */,
TREE_NUM_BASE DM_ID /* DM_ID = INTEGER */,
ROW DM_ID /* DM_ID = INTEGER */,
TREE_NUM_2 DM_ID /* DM_ID = INTEGER */,
TREE_NUM_3 DM_ID /* DM_ID = INTEGER */,
CMMNT DM_COMMENT_120 /* DM_COMMENT_120 = VARCHAR(120) */,
PRIORITY_ID DM_ID /* DM_ID = INTEGER */,
OBJECT DM_ID /* DM_ID = INTEGER */,
OBJEC_ID DM_ID /* DM_ID = INTEGER */,
COST_ID DM_ID /* DM_ID = INTEGER */,
MANAGE_ID DM_ID /* DM_ID = INTEGER */,
SPECIAL_ID DM_ID /* DM_ID = INTEGER */,
PAYTYPE_ID DM_ID /* DM_ID = INTEGER */,
PAYTYPE_DATE DM_PDATE /* DM_PDATE = TIMESTAMP */,
INV_STUFF DM_ID /* DM_ID = INTEGER */,
ARTICLE DM_ID DEFAULT 1 NOT NULL /* DM_ID = INTEGER */,
PRJ_CODE DM_ID /* DM_ID = INTEGER */,
OLD_TREE_BASE DM_ID DEFAULT -1 /* DM_ID = INTEGER */,
SUBSYS DM_ID /* DM_ID = INTEGER */,
GTR_NID DM_ID /* DM_ID = INTEGER */,
INSERT_BY DM_ID /* DM_ID = INTEGER */,
INSERT_TIME DM_PDATE /* DM_PDATE = TIMESTAMP */,
UPDATE_BY DM_ID /* DM_ID = INTEGER */,
LAST_UPDATE_TIME DM_PDATE /* DM_PDATE = TIMESTAMP */,
UPDATE_COUNT DM_ID /* DM_ID = INTEGER */,
PDATE DM_PDATE /* DM_PDATE = TIMESTAMP */,
TREE_BASE_R3 DM_ID /* DM_ID = INTEGER */
);

ALTER TABLE ACC$PREDOC ADD CONSTRAINT ACC$PREDOC$BES_BES_HAVE_VALUE CHECK((BED IS NULL) OR (BED = 0) OR (BES=0) OR (BES IS NULL));
ALTER TABLE ACC$PREDOC ADD CHECK(ARTICLE > 0);
ALTER TABLE ACC$PREDOC ADD CHECK(ARTICLE > 0);
ALTER TABLE ACC$PREDOC ADD CONSTRAINT UNQ1_ACC$PREDOC_ROW UNIQUE (ROW)
USING INDEX UNQ1_ACC$PREDOC;
ALTER TABLE ACC$PREDOC ADD CONSTRAINT PK_ACC$PREDOC PRIMARY KEY (NID);


/******************************************************************************/
/**** Foreign Keys ****/
/******************************************************************************/

ALTER TABLE ACC$PREDOC ADD CONSTRAINT FK_ACC$PD_DOC_LINK FOREIGN KEY (DOC_LINK) REFERENCES ACC$DOC (NID);
ALTER TABLE ACC$PREDOC ADD CONSTRAINT FK_ACC$PD_PAYTYPE_ID FOREIGN KEY (PAYTYPE_ID) REFERENCES ZMAZ$PAYTYPE (NID);
ALTER TABLE ACC$PREDOC ADD CONSTRAINT FK_ACC$PREDOC_1 FOREIGN KEY (TREE_BASE_R3) REFERENCES ACC$TREE$BASE$R3 (NID);
CREATE INDEX ACC$PREDOC_IDX3 ON ACC$PREDOC (DOC_LINK, NID);

CREATE TABLE ACC$TREE$BASE$R3 (
NID DM_ID NOT NULL /* DM_ID = INTEGER */,
SERIES DM_ID DEFAULT 6 NOT NULL /* DM_ID = INTEGER */,
CODE_BASE DM_ID NOT NULL /* DM_ID = INTEGER */,
PARENT DM_ID /* DM_ID = INTEGER */,
USE_BASE_CODE T_BOOLEAN_INT DEFAULT 1 /* T_BOOLEAN_INT = SMALLINT DEFAULT 0 NOT NULL CHECK(VALUE IN (0,1)) */,
ACC_CODE DM_CODE /* DM_CODE = NUMERIC(18,0) */,
GROUP1 DM_ID /* DM_ID = INTEGER */,
TREE_TYPE DM_ID NOT NULL /* DM_ID = INTEGER */,
TTYP DM_ID /* DM_ID = INTEGER */,
ROW DM_ID /* DM_ID = INTEGER */,
SHORT_CMMNT DM_COMMENT_110 /* DM_COMMENT_110 = VARCHAR(110) */,
PDATE DM_PDATE /* DM_PDATE = TIMESTAMP */,
TMP_CNV_NAME DM_NAME_L1 /* DM_NAME_L1 = VARCHAR(30) */,
TMP_OLD_PARENT DM_ID /* DM_ID = INTEGER */,
LINK_TYPE DM_ID /* DM_ID = INTEGER */
);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT UNQ1_ACC$TREE$BASE$R3 UNIQUE (SERIES, CODE_BASE);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT UNQ1_ACC$TREE$BASE$SER_A_CODE UNIQUE (SERIES, ACC_CODE);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT PK_ACC$TREE$BASE$R3 PRIMARY KEY (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_1 FOREIGN KEY (TREE_TYPE) REFERENCES ZMAZ$DAS$TREE$ITEM (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_CODEBASE FOREIGN KEY (CODE_BASE) REFERENCES ACC$CODE$BASE$R2 (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_GROUP1 FOREIGN KEY (GROUP1) REFERENCES ACC$TREE$BASE$R2$GROUP1 (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_LNKTYP FOREIGN KEY (LINK_TYPE) REFERENCES ACC$TREE$BASE$R3$LINK (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_PARENT FOREIGN KEY (PARENT) REFERENCES ACC$TREE$BASE$R3 (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_SERIES FOREIGN KEY (SERIES) REFERENCES ACC$SERIES$R2 (NID);
ALTER TABLE ACC$TREE$BASE$R3 ADD CONSTRAINT FK_ACC$TREE$BASE$R3_TTYP FOREIGN KEY (TTYP) REFERENCES ACC$TREE$BASE$TYP (NID);

CREATE INDEX ACC$TREE$BASE$R3_IDX1 ON ACC$TREE$BASE$R3 (PDATE);
CREATE INDEX ACC$TREE$BASE$R3_IDX2 ON ACC$TREE$BASE$R3 (TTYP);
CREATE INDEX ACC$TREE$BASE$R3_IDX3 ON ACC$TREE$BASE$R3 (SERIES, PARENT);
CREATE INDEX ACC$TREE$BASE$R3_IDX4 ON ACC$TREE$BASE$R3 (SERIES, NID);
CREATE INDEX ACC$TREE$BASE$R3_IDX5 ON ACC$TREE$BASE$R3 (PARENT, NID);
CREATE INDEX ACC$TREE$BASE$R3_IDX6 ON ACC$TREE$BASE$R3 (SERIES, PARENT, NID);