Subject database growing too much after bulk import
Author Sergio H. Gonzalez
Hello! I'm using FB2.1.1

I have this database:

Database "C:\sg\Delphi\SoloFrenos\DATOS.FDB"
Database header page information:
Flags 0
Checksum 12345
Generation 1283
Page size 4096
ODS version 11.1
Oldest transaction 927
Oldest active 1274
Oldest snapshot 1274
Next transaction 1275
Bumped transaction 1
Sequence number 0
Next attachment ID 44
Implementation ID 16
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Oct 28, 2008 14:54:59
Attributes force write
Variable header data:
Sweep interval: 20000


It has 8,186 KB with some tables filled with some records. After I do an import
from a DBF table (38.000 records) into this particular table:


CREATE TABLE STOCK (
ID ID /* ID = NUMERIC(9,0) */,
CODIGO CODIGO /* CODIGO = CHAR(30) */,
DESCRIPCION DESCRIPCION /* DESCRIPCION = VARCHAR(150) DEFAULT
'' */,
CODIGO_SEGUN_PROVEEDOR VARCHAR(50),
ID_SUBGRUPO ID DEFAULT 0 /* ID = NUMERIC(9,0) */,
ALICUOTA_IVA NUMERIC(6,2),
COSTO MONEY /* MONEY = NUMERIC(18,3) DEFAULT 0 */,
DIAS_GARANTIA SMALLINT,
ID_MONEDAS ID /* ID = NUMERIC(9,0) */,
IMAGEN IMAGEN /* IMAGEN = BLOB SUB_TYPE 0 SEGMENT SIZE 100
*/,
DESCRIPCION_ADICIONAL DESCRIPCION /* DESCRIPCION = VARCHAR(150) DEFAULT
'' */,
ID_PROVEEDOR ID /* ID = NUMERIC(9,0) */,
CANTIDAD CANTIDAD /* CANTIDAD = INTEGER DEFAULT 0 */,
CANTIDAD_MINIMA CANTIDAD /* CANTIDAD = INTEGER DEFAULT 0 */,
CANTIDAD_MAXIMA_PEDIDOS CANTIDAD /* CANTIDAD = INTEGER DEFAULT 0 */,
PRECIO_LISTA MONEY /* MONEY = NUMERIC(18,3) DEFAULT 0 */,
PRECIO_LISTA_ANTERIOR MONEY /* MONEY = NUMERIC(18,3) DEFAULT 0 */,
PRECIO_VENTA MONEY /* MONEY = NUMERIC(18,3) DEFAULT 0 */,
PRECIO_VENTA_ANTERIOR MONEY /* MONEY = NUMERIC(18,3) DEFAULT 0 */,
NOTAS NOTAS /* NOTAS = BLOB SUB_TYPE 0 SEGMENT SIZE 100
DEFAULT '' */,
UBICACION CHAR(15),
DESCUENTO_OFERTA PORCENTAJE /* PORCENTAJE = NUMERIC(8,3) DEFAULT 0
*/,
ID_MARCAS ID /* ID = NUMERIC(9,0) */,
CODIGO_BARRAS CODIGO /* CODIGO = CHAR(30) */,
MODIFICADO_MANUAL DATE,
MODIFICADO_AUTO DATE,
ACTIVO BOOLEAN /* BOOLEAN = CHAR(1) DEFAULT 'n' */
);


ALTER TABLE STOCK ADD CONSTRAINT PK_STOCK PRIMARY KEY (ID);


ALTER TABLE STOCK ADD CONSTRAINT FK_STOCK_1 FOREIGN KEY (ID_MARCAS) REFERENCES
STOCK_MARCAS (ID);
ALTER TABLE STOCK ADD CONSTRAINT FK_STOCK_2 FOREIGN KEY (ID_PROVEEDOR)
REFERENCES PROVEEDORES (ID);
ALTER TABLE STOCK ADD CONSTRAINT FK_STOCK_3 FOREIGN KEY (ID_MONEDAS) REFERENCES
MONEDAS (ID);
ALTER TABLE STOCK ADD CONSTRAINT FK_STOCK_4 FOREIGN KEY (ID_SUBGRUPO) REFERENCES
STOCK_SUBGRUPO (ID);


CREATE INDEX IDX_STOCK ON STOCK (CODIGO_SEGUN_PROVEEDOR);
CREATE UNIQUE INDEX STOCK_IDX1 ON STOCK (CODIGO);

The database grows to 190,416 Kb !!
Is that normal? The DBF I'm importing it's 10 MB, Of course I know that the
relation between the DBF size and the growing on my databse may have very little
to do, but I'm very surprised by the new size my DB gets after the import !.

Just in case: After the import I'm doing a backup/restore to make sure there's
no non used space in my DB.

Thank you very much!!

-sergio