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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indexing Logical fields

Status
Not open for further replies.

jerold

Programmer
Aug 30, 2000
52
PH
How do I setup the code for indexing on fields that
are logical?

Thank you. [sig][/sig]
 
jerold

SELE table
INDEX ON <field> TAG <tag name> && Where <field> is the logical field name, and <tag name> is the name you wish to give to the index tag.

Chris [sig][/sig]
 
But...you may not experience much of a gain, and in some circumstances may actually hinder performance (I'm drawing more on my SQL Server experience here, but I believe the same is true of VFP).

Logical fields have low selectivity, meaning that there are very few (two, in this case) different values.

You should run some before-and-after tests with your anticipated row counts to see if you get a gain in performance. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Microsoft recommends, however, to index all tables by 'Deleted()' function for better performance when SET DELETED ON.
RUSHMORE optimization is not only based on selectivity. When you select many rows in query, such logical indexes may help a lot.
[sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
I am creating a table using recordset.How to give a regular index to a field programatically.
 
You create an index just like Chris indicates above. Of course if by 'recordset' you mean a view or cursor, you can't create an index. But you can use an ORDER BY clause in the SQL used to produce much the same effect.

Dave Dardinger
 
HI Arunrote,

1. myDBF = SYS(3)
Let us say the record set you created is a table (myDBF)
INDEX ON myField TO TAG myField
This line will create the index tag for your myField as (myDBF).CDX

2. If you want an IDX file
INDEX ON myField TO idxFileName
SET INDEX TO idxFileNAME

Hope this helps you :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
I don't think SQL statements will benefit much but if you're using 'set index - seek - do sumpnrother while' based on the tag it will be very fast.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top