Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database size
Message
De
23/05/1999 20:01:05
 
 
À
22/05/1999 10:13:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00221419
Message ID:
00221949
Vues:
12
>>>>ok.. we are very hard pressed for space on a database that has to fit onto a single cd. we have played with changing large char fields to memo fields and in some cases it saves space, other times it seems to make the database bigger. Does a memo field with say 10 char take up more space than say a char field with 10 char.. is there a rule of thumb as to how much space a memo field will take up (empty one)
>>>
>>>Memo fields have a permanent 4 byte overhead in the DBF whether they are filled or not. When a memo field is filled, it has blocks of space (I think the default is 64 byte blocks) allocated in the .FPT file. IOW:
>>>
>>>An empty memo field takes up 4 bytes in the .DBF per record.
>>>A non-empty memo field takes the same 4 bytes, plus the minimum number of blocks needed to store the value. A 1 byte value will occupy 1 block in the .FPT file, so if blocks are 64 bytes in length, a 1 byte long value takes up (4 + 64) bytes of storage. And there's some overhead involved in chaining blocks together.
>>
>>
>>what are the effects of block chaining with SET BLOCKSIZE TO 0?
>
>I've never tried; I'd suspect that there's a tremendous penalty, since the pointer to the next block is probably bigger than each individual block. Why not try it and report back?

There is no penalty in file size (performance?), the blocks allocated for a record have no linkage overhead -- they are just adjacent allocations.

I used the following code to test:
#define LOOP 5000

set safety off

create table blockstats free (rcount i, bytes i, filesize0 i, filesize64 i)

for j = 1 to LOOP step 1000

	set blocksize to 0
	create table blocksize0 free (testdata m)

	set blocksize to 64
	create table blocksize64 free (testdata m)

	lnbytes = 0
	for i = 1 to j

		lnbytes = lnbytes + i
		datalen = i % 8192
		
		insert into blocksize64 (testdata) values (replicate("X", datalen))
		
		insert into blocksize0 (testdata) values (replicate("X", datalen))

	endfor

	select blocksize0
	use
	select blocksize64
	use

	=adir(lafiles, "*.fpt")
	lnfilesize0 = lafiles[ASUBSCRIPT(lafiles, ascan(lafiles, "BLOCKSIZE0"), 1), 2]
	lnfilesize64 = lafiles[ASUBSCRIPT(lafiles, ascan(lafiles, "BLOCKSIZE64"), 1), 2]
	insert into blockstats (rcount, bytes, filesize0, filesize64) values (j, lnbytes, lnfilesize0, lnfilesize64)

endfor
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform