Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
.idx vs .cdx
Message
From
14/05/2005 13:57:17
 
 
To
14/05/2005 06:46:59
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 6 SP5
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01014169
Message ID:
01014239
Views:
17
>Hi Fabio,
>
>>Attention, .idx can to be 2X faster.
>
>usually if I am in need of speedier index I create a temporary index in a ramdisk (helped a lot in NT4, less in more current OS). Since I want to keep things simple for possible transaction and/or datasession scenarios I also use compound indices here - but since this is for speed, I might reconsider and add a way to branch out to use idx. Have you found any rules of thumb under which circumstances (rushmore or seek() ?) the idx is faster ? Perhaps even how much gain can be estimated ? Any hypothesis as to reason ?
>
>regards
>
>thomas

Hi Thomas,
SET TALK OFF
CLEAR
? "FIELDTYPE","COMPACT" AT 15,"RAW" AT 35,"COMPACT" AT 55
FOR FLDTYPE=1 TO 6
	? M.FLDTYPE,SPACE(3)
	=TEST(m.FLDTYPE,.t.),TEST(m.FLDTYPE,.f.),TEST(m.FLDTYPE,.T.)	&& CHECK CACHE EFFECT
NEXT

PROCEDURE TEST(TYPEFIELD,COMPACTINDEX)

TF=0
TR=0

FOR JJ=0 TO 3

	DO CASE
		CASE TYPEFIELD=1
			CREATE CURSOR TestIndex (F1 L DEFAULT RAND()>0.5)

		CASE TYPEFIELD=2
		
			CREATE CURSOR TestIndex (F1 I DEFAULT RAND()*100000)

		CASE TYPEFIELD=3
		
			CREATE CURSOR TestIndex (F1 D DEFAULT DATE()+RAND()*10000)

		CASE TYPEFIELD=4
		
			CREATE CURSOR TestIndex (F1 T DEFAULT DATETIME()+RAND()*10000)

		CASE TYPEFIELD=5
		
			CREATE CURSOR TestIndex (F1 N(15,8) DEFAULT RAND()*100000)

		CASE TYPEFIELD=6
		
			CREATE CURSOR TestIndex (F1 V(99) DEFAULT REPLICATE(CHR(RAND()*256),RAND()*100))
	ENDCASE

	IF m.COMPACTINDEX
		INDEX ON F1 TAG SCDX
	*	INDEX ON F1 TAG NCDX OF ONECDX.CDX
	*	INDEX ON F1 TO TAGIDX.IDX COMPACT && THIS IS USELESS
	ELSE
		INDEX ON F1 TO TAGIDX.IDX	&& IF YOU CHECK THE TAGIDX.IDX SIZE, YOU FOUND 0 BYTES, THEN IT IS A RAMDISK FILE
	ENDIF

	SET ORDER TO

	T1=SECONDS()
	FOR K=1 TO 100000
		APPEND BLANK
	NEXT
	tf=tf+SECONDS()-t1

	T1=SECONDS()

	REINDEX
	tr=tr+SECONDS()-t1
	USE
NEXT
?? STR(TF/m.jj,6,3),STR(tr/m.jj,6,3),SPACE(5)
I use a Idx into grid column reorder, and like temp index on a routine.

Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform