473,772 Members | 3,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Indexes and Primary key

Hello

I'm trying to find the best way to set indexes and primary keys on MSAccess
tables

What are the advantages and disadvantages of indexes and primary keys?
What fields should be indexed?
Should I index more than one field per table?
What fields should have the primary key?

and so on

Is there any good reading material on this available?
Thanks
G Gerard
Apr 18 '06 #1
1 1855
"GGerard" <gg*****@nbnet. nb.ca> wrote in
news:In******** *************@u rsa-nb00s0.nbnet.nb .ca:
Hello

I'm trying to find the best way to set indexes and primary
keys on MSAccess tables

What are the advantages and disadvantages of indexes and
primary keys? What fields should be indexed?
Should I index more than one field per table?
What fields should have the primary key?

and so on

Is there any good reading material on this available?
Thanks
G Gerard

The primary key to a table is a field or combination of fields
which uniquely identify a row in that table. You can often use
an autonumber field as a surrogate primary key. Some people will
say this is correct, others will claim that the natural primary
key is best. Personally, being an old dBase III programmer, I
avoid autonumbers. You may have database designs where you have
multiple candidates for primary key. These should be indexed.

As to general indexes, the idea is that if you use a field to
sort the table, or a combination of fields, these fields or
groups should be indexed, even if they are not the primary key.
You should also index fields and groups that are used to filter
the table.on a regular basis.

Some claim that the foreign keys in a table should be indexed
too. Foreign keys are the references used as the relation to
another table's primary key. Access apparently does this
automatically when you set a relation, but I don't have any
reason to believe that this is important. .

For reading material, any good textbook on relational database
design will discuss these topics in greater detail, try your
public or university library.

This web article is also good:
http://www.databasejournal.com/sqlet...le.php/1469521

--
Bob Quintal

PA is y I've altered my email address.
Apr 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1983
by: robertbrown1971 | last post by:
I just inherited a Java application with a fairly complex data model that does not yet have any indexes except those on primary keys. It is still in development and before I get to do any performance testing I want to put some default indexes on it. I realize that this a very vague request but it's better than nothing so I want to start with those that are generally a good idea and then tune those areas that require more fine grained...
3
4382
by: CSN | last post by:
In phppgadmin, primary keys are added/shown under "constraints". Does creating a primary key automatically create an index? No indexes are listed under phppgadmin's indexes page, but "\d table" in psql shows indexes for primary keys. __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/
2
1743
by: alex.mcshane | last post by:
Hi - I would be grateful for guidance regarding the following. (Please note that my DB2 backgorund is principally OS/390. I have only recently become involved in DB2 for LUW). OVERVIEW I have been using Scripted Files to Create Tables and an associated Primary Indexe via the DB2 Command Window.
2
3315
by: tekanet | last post by:
Hello folks, I'm developing a program that reads an access MDB file and produce some scripts to rebuild the same structure against other databases (MSSQL, MySQL and so on). Reading structure of tables and fields was quite simple. Now I'm stuck because I can't find where to read to access infos about indexes and relationships. Probably for relationships I've to read the hidden table MSysRelationships (I didn't do that 'till now), but I...
5
1508
by: Shiraz | last post by:
Is there some manual on how to make indexes? for example: table is create mytable ( a varchar, b varchar, c int, d int
2
4349
by: Lyle Fairfield | last post by:
'Property Clustered As Boolean 'Member of DAO.Index Private Sub IsThereaClusteredIndex() Dim tdf As DAO.TableDef Dim idx As DAO.Index For Each tdf In DBEngine(0)(0).TableDefs For Each idx In tdf.Indexes Debug.Print tdf.Name, idx.Name, idx.Primary, idx.Clustered Next idx
14
19682
by: Jeff | last post by:
This is the first time that I remember ever having too many indexes on a table, but it has happened. I have en employees table and store in many places, on tables, the id of the employee that performed some action. Yes, I know, that could be in an audit trail but it isn't. For example, who printed a sales order, who processed it etc is stored on the sales orders table. Well, I have run out of indexes on the employees table when trying...
22
1778
by: Zamdrist | last post by:
I am tasked with maintaining a large database still on SQL Server 7.0. Performance is an issue not surprisingly and I've targeted two rather large tables to see what I can do with the indexes. The 2 tables are described as follows: MatterConflicts: Fields: MatterConflicts varchar(16), Matters varchar(16), HitMatters varchar(16), IsInclude varchar(1) Index: MatterConflicts
0
7598
MMcCarthy
by: MMcCarthy | last post by:
The more data you include in your tables the more you will need to have indexes to search and sort that data. However, there is a balance between having enough indexes and too many. Too many indexes will slow down the speed of updates on your records. Access presets a number of Indexes for you. If you look in Tools ... Options under the Tables/Queries tab you will see that under "Auto Index on Import/Create" there is a list as follows: ...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.