Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Info On Index Tags- Using Deleted() 2

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
I'm new to Visual FoxPro. Last FoxPro used was mfoxplus.exe circa 1992. Anyway, I'm having trouble grasping the Rushmore Optimization concerning index tags. I'm using the database container and compound indexes. It said I should use an index tag for deleted() on every table. What specifically is an index "tag" referring to?

Let's say I have a table named Master with indexes named Workers that represents a field named WorkerID and an index named "Deleted" which uses the function "deleted()".

First, does the term "tag" refer to the index name specified (Worker) or is it a property of the index itself?

Second, does the index "Deleted" need to be created for every table to provide the ability to utilize the Rushmore Optimization or does it need to be included in every indexes' formula to to be used?



 
When you issue the command
[tt]index on WorkerID tag Workers[/tt]
"WorkerID" (a column in your table) is the expression used to build the index, and "Workers" is the tag name given to this particular index. A single structural or compound index (the CDX file) can hold many different indexes; it uses the tag name to differentiate between them. In one given CDX, no two indexes can use the same tag name.

So, to set the active index to Workers, you issue the command:
[tt]set order to workers[/tt]

As you probably already know, all structural indexes (unlike standalone IDX files) are automatically updated when the data changes.

I would say that generally most VFP developers use the column name for the tag name for simplicity, such as:
[tt]index on workerid tag workerid[/tt]
but this is not required; your naming convention is fine.

You never need to index on DELETED(). The only time you will want to is if you commonly have SET DELETED ON. If you normally run with SET DELETED OFF, then forget about it.
Robert Bradley
 
Using the tag deleted() seems to help VFP run faster by allowing rushmore to skip deleted records. At least that is the theory I've seen stated as the reason for the tag. Rushmore is so fast that it is hard to tell if it's true.

I generally have a set of tags that have the for clause not deleted() added. That speeds things up a bit too. However, for debuging purposes they should be duplicated without the for clause.

When Visual Fox first came out CDX were called compound indexes. They work a lot like the old IDX's execpt that they are all in one table. They are also normally attached to the DBF and so open automatically with it.

Bill Couture
 
Are you aware that indexes with a for in them, otherwise known as filtered indexes are never used for rushmore optimization?
 
Bill,

This is a problematic question that requires investigation. For large databases indexes are quite large. When querying data over network, downloading each index through the network takes significant time. In such case usually all logical field indexes (inlude deleted()) gives no benefits or even slow down query in general. If database contains a lot of deleted records, this might help. If little (less than 5%) - no reason to think about that, deleted() index goves no significant benefits.




Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top