Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What kind of index is best?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00293722
Message ID:
00293732
Views:
23
Integers are quicker. see: http://fox.wikis.com/wc.dll?wiki~IntVsChrSpeed

Surrogate Keys will eliminate the compound key issue.

You may still need some uniqueness constraints that get built into your table, like to make sure that the same invoice item # is not duped for one invoice.

create database inv
create table Inv ( pkInv i primary key, iInvNo i unique )
create table InvItem ( pkInvItem i primary key, fkInv i references Inv, iItm i, unique BinToC( fkInv ) + BinToC( iItm ) tag InvItm )

If you start using views and SQL syntax you will find that you don't need to worry about the compound issues as much. I think it is a wise career move anyway.


>What do you think is best to use in a VFP project when it comes to character indexes or integer indexes? If you use a integer it is very easy to just generate next key. But some times you need a compound index as in browsing items on an invoice. Then I will need a index like Str(invoice_id)+Str(item_id), which is not so easy and fast? to use. What is your opinion on using integer indexes or character indexes as primary key?
Previous
Reply
Map
View

Click here to load this message in the networking platform