473,811 Members | 3,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table Index Construction

In a table design, properties window there is the Indexes/Keys tab.
I want to create a few indexes.

Row myID is the PK.
I also want indexes on rows myOne, myTwo, myThree.

In the selected index window: PK_tblName I see myID.
Do I put myOne, myTwo, myThree under that in the same index or do I
create three new indexes for the table?

Maybe this is DB Design 101 but it's not intuitive.

Any help is appreciated.
lq

Nov 13 '05 #1
3 1733
"lauren quantrell" <la************ *@hotmail.com> wrote in
news:11******** ************@f1 4g2000cwb.googl egroups.com:
In a table design, properties window there is the Indexes/Keys
tab. I want to create a few indexes.

Row myID is the PK.
I also want indexes on rows myOne, myTwo, myThree.

In the selected index window: PK_tblName I see myID.
Do I put myOne, myTwo, myThree under that in the same index or
do I create three new indexes for the table?

Maybe this is DB Design 101 but it's not intuitive.

Any help is appreciated.
lq

If you put myOne, myTwo and myThree under the same index name,
you have one index that sorts on the Primary Key, and the myOne
within the primary key, myTwo within myOne etc, and the whole
thing becomes the primary key. I doubt that this is what you
want.

Each index should be given a separate name, but may contain
multiple columns. So you could build indixes for myOne, myTwo,
and another index that sorts by myThree and myOne if it makes
sense to order that way.

Note that you don't need to create many manual indixes as Access
automatically indexes fields related in the relationships
window.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2
From:Microsoft® Jet Database Engine Programmer's Guide

**** begin quote ****
Use Indexes Cautiously
Although having indexes can reduce the time it takes to retrieve data,
they always carry a cost in maintenance and concurrency issues. When
should a field be indexed? There is no strict answer for this because
it depends on the type of application.

The first guideline is that fields containing highly duplicated data
should not be indexed (for example, fields with the Yes/No data type,
and fields that represent gender, state abbreviations, or country
codes).

The second guideline is that fields should not be indexed simply to
force Rushmore to use more than one index. An example of this would be
indexing a field called City and a field called PostalCode in a
customer table when the application is always going to be using both
fields for retrieval purposes. In this instance, the PostalCode field
is going to be the most unique index and would return a result set
faster if the City field was not indexed. Because Rushmore doesn't
need to use the index on the City field, omitting the index on the City
field will reduce overall disk I/O. Of course, if both values were not
always being entered and they were used alternatively and equally, then
having an index on both fields would probably be advantageous. Rushmore
is best utilized on combined indexes when they are required to generate
a unique result set.

It is also important to remember that indexes create concurrency
issues. One index page represents many data pages. Therefore, modifying
an index page can cause users with data on an entirely different data
page to be locked out when trying to update the indexed field.

To see this behavior, open the Northwind database in Microsoft Access
97 and turn on pessimistic locking by clicking Edited Record on the
Advanced tab of the Options dialog box (Tools menu). Update a value in
one indexed field in the Customers table, but don't move to the next
record. On another workstation, open the Customers table and try to
edit another value in the same indexed field that the other workstation
is editing. Next, try updating a value in a non-indexed field in the
Customers table. What will become evident is that substantially more
records of data are locked when you try to update a value in an indexed
field than when you try to update a value in a non-indexed field.
**** end quote ****

Nov 13 '05 #3
"lylefair" <ly******@yahoo .ca> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
From:Microsoft© Jet Database Engine Programmer's Guide

**** begin quote ****
[snip]
The first guideline is that fields containing highly duplicated
data should not be indexed (for example, fields with the Yes/No
data type, and fields that represent gender, state abbreviations,
or country codes).


I know this is the orthodoxy on this issue, but I don't follow it.

I've found in plenty of cases that sparsely-populated indexes (i.e.,
indexes with a small number of unique values) can massively speed up
selects that involve those fields. This includes Boolean fields, but
the most common case where I've encountered this is in one of the
fields I use for stamping records with data about who edited it. My
general approach is to have Created, Updated and UpdatedBy fields.
The first two are dates (with Default=Date()) , and the last a text
field that I populate from CurrentUser() or from the Windows user
name (depends on the app). UpdatedBy never has a large number of
unique values as none of my apps are being used by more than a
couple dozen unique users.

So, by the orthodox rule, you'd not index such a field.

But when I *don't* index it, my routines to retrieve and sort and
count for the user stats take much, much longer. So, I put in the
indexes, despite the logic behind the orthodox rule not to index
such fields.

And I've seen the same thing on Boolean fields.

It does seem to me, though, that fields that have lots of Null
values are not speeded up nearly as much as those where all records
have a value.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4

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

Similar topics

10
7863
by: John | last post by:
I have a table with two rows. On the first row is a text box and in the second row is an image. I have set the table cellpadding to 0 and cellspacing to 0. The table is leaving extra spaces in the rows on the top and bottom of the picture and image. I need to make the height of the rows to be the same as the textbox and image. How do I do this? I have tried even setting the height of the table and all the <td> and <tr> tags to 1 but have...
6
3783
by: Joe | last post by:
I have a: vector<string> which contains a few dozen elements. I want to find the index of the element containing a certain string. for example: vector<string> strings; strings.push_back("abc"); strings.push_back("xyz"); strings.push_back("lmnop");
16
21365
by: mamo74 | last post by:
Hello. I am administering a SQL Server (Enterprise Edition on Windows 2003) from some month and can't understand what is going on in the latest week (when the db grow a lot). The DB is around 250G, and has one table with 1 billion rows. It is performing in a decent way, but can't understand why a particolar table has strong performance problem.
9
2772
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with each having 3 fields each, their own PK; the FK back to the parent table; and the unique data for that table. There is a one to many relation between the parent and each of the 9 child rows. Each child table has between 100,000 and 300,000
7
10819
by: Bing Wu | last post by:
Hi Folks, I have a very large table containing 170 million rows of coordinats: CREATE TABLE "DB2ADMIN"."COORDINATE" ( "FID" INTEGER NOT NULL , "AID" INTEGER NOT NULL , "X" REAL NOT NULL , "Y" REAL NOT NULL , "Z" REAL NOT NULL )
2
1451
by: Bart Van der Donck | last post by:
Hello, I'm having difficulties to understand why the code below doesn't work. The idea is to generate an <iframe> with a higher z-index compared to an <object>. In Microsoft Internet Explorer 6, everything works fine, but Firefox/Netscape seems to have problems with this construction. Am I overlooking something ? -------------------------------------------
14
5122
by: Gert Cuykens | last post by:
Is there a difference between <code> class HelloWorld: def index(self): index.exposed = True return "Hello world!" </code> and
4
3724
by: Hemant Shah | last post by:
Folks, Our client has a program that browses whole table from begining to end. The table has 1 million rows in it. REORGCHK does not show any problems. It has unique index defined on KEY0 column. If I use SELECT statement without OPTIMIZE FOR clause, then it uses temporary table to sort the data, but if I use OPTIMIZE clause then it uses index access without temporary table. If I use OPTIMIZE FOR more than 700 rows then it uses...
0
10652
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...
1
10408
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
10137
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...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7673
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
6895
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
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.