Subject Re: Problem with growing database
Author Sten Karlson
Hi Set and thanks for your answer!

If I understand you right IB will store a copy of the old version of
the record I am doing UPDATE on and deletes the copy when I do
COMMIT. I have to check if tere are any hanging transactions but I'm
pretty sure that I allwas do COMMIT. I read data from my devices
every 0.1 or 0.2s and if the values have changed since last time I
UPDATE the DATA table. After I have read allvalues from the system
and stored the ones needed to store I do a COMMIT. This means in
reality that between 5 to 25 values are updated in datatable and
stored in the trend table every 100ms.

You suggests that I will run the delete quiery every hour for
instance. Do you or anyone have a suggestion on a quier that
doesen't take much CPU power. And what should the index look like to
optimize performance

My trend table looks like this and contains about 4 million rows and
I want to delete all records older than a week.

I'm currently using IBX components and I'm writing my application in
C++ Builder 6.

/* Table: TREND */

CREATE TABLE TREND (
DATETIMEFLOAT DOUBLE PRECISION NOT NULL,
TAGNR INTEGER NOT NULL,
VALUE DOUBLE PRECISION,
CREATOR VARCHAR (8));
/* Primary keys definition */

ALTER TABLE TREND ADD CONSTRAINT PK_TREND PRIMARY KEY
(DATETIMEFLOAT, TAGNR);

Thanks again