Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Blocksize question
Message
From
24/07/2002 07:37:39
 
 
To
24/07/2002 07:23:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00681544
Message ID:
00681967
Views:
23
>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform