Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Blocksize question
Message
De
24/07/2002 07:37:39
 
 
À
24/07/2002 07:23:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00681544
Message ID:
00681967
Vues:
24
>>>Thanks.
>>>
>>>I know how to do this. My question is: Will Visual FoxPro be slower if I SET BLOCKSIZE TO 0?
>>>
>>>Hilmar.
>>
>>
>>Hilmar,
>>
>>I've never tested whether vfp was slower with 1 byte allocation on memo. It saves a lot of space though.
>>
>>IMO the difference will very small considering that
>>- the 1 is the minimal block
>>- the space for an entire memo is allocated sequentially (repl memo with newvalue discards the old space and allocates new space)
>>
>>just my opinion
>
>Thanks. I think I will end up changing the blocksize at least in one very large file (audit trail) - in my tests, the space saving is, indeed, significant.
>
>Hilmar.

It's not only the space saving imo, it may be faster with blocksize 0. Imagine memos of 10 chars and blocksize 512bytes. Then you have about 500 bytes of wasted space that are read anyway and occupy memory in the cache. Also, if you read the file sequentially the odds are bigger that the memo is already in memory (forget about the readahead for a moment)

To reset the blockSzie to a number :
procedure	AlterBlockSize(_table, n)

	local OldBlockSize, location
	OldBlockSize = set('BlockSize')

	use (_table) excl in 0
	location = fullpath(dbf(_table))
	location = addbs(JustPath(Location)) + JustStem(location)
	
	
	set blocksize to n
	alter table (_table) add x123456 L default .F. NOVALIDATE
	alter table (_table) drop x123456 NOVALIDATE
	use in (_Table)
	
	set BlockSize to (OldBlockSize)
	
	delete file (location + '.BAK')
	delete file (location + '.TBK')

endproc
*---------------------------------------------------------------------------
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform