Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binary Indexes Perform Slower?
Message
De
24/09/2004 04:58:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00945611
Message ID:
00945650
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Hi Mark, BINARY is faster for me.

The test is too simple.
Reverse the order, before test regular and after test binary, result are reversed.
probably for the first time it is demanded a time of memory allocation.

Run this,
larger it is iSize and greater it is the BINARY advantage:
CLEAR
SET TALK off
SET DELETED OFF
SYS(3054,0)
CREATE CURSOR crsBin (f1 c(2), f2 L)

iFrequency = 5/100
iSize = 100000
FOR lnI = 1 TO m.iSize
   INSERT INTO crsBIn (f2) VALUES (RAND()<m.iFrequency)
ENDFOR

nLoop = 10000000/RECCOUNT()

SELECT crsBin
DELETE TAG ALL
? [TIME (no index):], doSELECT(m.nLoop/10)*10
?

SELECT crsBin
DELETE TAG ALL
INDEX ON f2 TAG f2bin
? [TIME (regular cdx index):], doSELECT(m.nLoop)
?

SELECT crsBin
DELETE TAG ALL
INDEX ON f2 TAG f2bin binary
? [TIME (binary index):], doSELECT(m.nLoop)
?
SELECT crsBin
DELETE TAG ALL
INDEX ON f2 TO f2idx
? [TIME (regular idx index):], doSELECT(m.nLoop)

PROCEDURE doSELECT(nTimes)
lnSeconds = SECONDS()
FOR K=1 TO m.nTimes
	SELECT COUNT(*) FROM crsBin WHERE !f2 INTO CURSOR crsResults nofilter
NEXT
USE
RETURN SECONDS() - lnSeconds

* iSize=10000    : 1.1 x faster
* iSize=100000   : 2.0 x faster
* iSize=1000000  : 3.0 x faster
Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform