V4MD: reducing file size

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jun 22 21:35:59 CDT 2004


On 6/22/04 9:00 PM, "Andrew Sinning" <andrew at learningware.com> wrote:

>> when you have NOT many data in your tables or even EMPTY tables,
>   Valentina still will pre-allocate that segment for each file.
> 
> 
> What do you mean by "for each file" ??  Please define "file".  I don't
> understand why in the world would the .dat file be EXACTLY the same size
> when I have removed 90% of records.

Ok, look.

Valentina keep db in 1-4 files, right?
This means that Valentina have own INTERNAL FILE system.

This means that when you create a field in table,
Valentina may create FEW logical internal disk files

    - one for field
    - for BLOB and VarChar one helper file
    - one for index
    - may be another helper index

So if you will make in table 10 fields, Valentina allocate
10 segments.  10 *32 = 320KB.

If you make in table 100 fields, then empty table will use 100 * 32 = 3.2MB
Minimum.


--
Now why after deletion you do not see reducing.

You have LONG fields, yes? 4 bytes.

32KB segment can contain 8000 records.

So if you have 
    ZERO or 1 or 2 or ... 8000 records then you still will use one segment.
    
Only when you add 8001 record, then Valentina will allocate next 32KB on
disk. You see?

> Does the .dat have by default space for some X number of records.

In general yes, but it is not psosiblle how many.
Because 

    for LONG field this is 32KB / 4 bytes = 8000
    for byte field this is 32KB / 1 byte = 32000 records.
    for string much less.

In other words if you have in record different types of fields, then each
field will fill segment with different speed. You do not see this process,
and should not care about this.

> I understand that it has to make room for the data in each record.  But more
> records should result in more space, and fewer records should result in less
> space.  I'm not saying you are wrong (obviously).  I'm just saying that I
> don't understand your explaination.

I hope now it is more clear.

Just all big DBMS do such pre allocation. This is more effective.
In fact MS SQL Server pre-allocate not one segment as Valentina, but 8
segments on default.



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list