Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it reasonable to have index on DELETED()?
Message
From
18/03/1999 07:44:58
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00196021
Message ID:
00199122
Views:
34
David,

You almost did get me, but there is something you overlooked.
See my notes below...

>Then run this program 4 times:

>* deltag1on
>clear
>close data all
>use deltest in 0
>set deleted off && I asume this must be SET DELETE ON
>lnStart = seconds()

>for i = 0.0 to 0.9 step 0.1
> lcMin = str( i, 10, 8 )
> lcMax = str( i+0.1, 10, 8 )
> select * ;
> from deltest ;
> into cursor x1 ;
> where c1 >= m.lcMin and c1 < m.lcMax && add NOFILTER
>endfor

>? seconds() - lnStart

>Now run this program 4 times:

>* deltag1off.prg
>clear
>close data all
>use deltest in 0
>set deleted off
>lnStart = seconds()
>for i = 0.0 to 0.9 step 0.1
> lcMin = str( i, 10, 8 )
> lcMax = str( i+0.1, 10, 8 )
> select * ;
> from deltest ;
> into cursor x1 ;
> where c1 >= m.lcMin and c1 < m.lcMax && add NOFILTER
>endfor
>? seconds() - lnStart

>In the command window:
>index on deleted() tag deleted

>rerun each the last two programs 4 times and observe the performance >improvement. For my P2-300 Dell notebook, 64 meg, Win98, VFP6, local drive. I get these results:

>Before the deleted tag exists:

>deltag1off: 0.559, 0.576, 0.553, 0.552
>deltag1on: 14.040, 13.275, 13.376, 13.360

>After the deleted tag is created:

>deltag1off: 0.555, 0.557, 0.554, 0.553
>deltag1on: 3.214, 2.421, 2.407, 2.417

David,

The figures made me thinking, how can there be such a difference between SET DELETE ON and SET DELETE OFF without the INDEX TAG ON DELETED() ?

Then i came to the conclusion that your query's make a FILTER rather that EXECUTE these query's. In practice these type of query's are rare and mostly not wanted.

If you add a NOFILTER to the query's you'll come to the conclusion that the query's with an index on DELETED() will be slightly SLOWER than the query's without an index.

Conclusion:

There is no benefit to the DELETED() tag UNLESS you want to speed up queries where the optimizer can set a filter. As an alternative you can also open the table by yourself and issue a SET FILTER.


Regards,

Walter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform