473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

when to use indexes

Hi Everyone

Is there anyone who has some sound rules of thumb for using indexes.

I see that, for example, access automatically adds them to linked tables,
but I feel, they are probably of more use in text fields (for sorting
purposes), etc....

Keen to hear your ideas.

Thank you (or as we say: CHEERS)


---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004
Nov 13 '05 #1
4 1741
"WindAndWaves" <ac****@ngaru.com> wrote in news:ScOwc.1058$GB4.35933
@news.xtra.co.nz:
Is there anyone who has some sound rules of thumb for using indexes.


Pretty old advice from
Microsoft® Jet Database Engine Programmer’s Guide!
The last paragraph (is it still valid?) may describe an issue which can be
overlooked.

**** 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.
**** quote ****

--
Lyle
(for e-mail refer to http://ffdba.com/)
Nov 13 '05 #2
Ok,thanks for that, so does that mean that if someone is adding information
to a table with an index and someone is editing another record in the table
at the same time that then there will be concurrency issues????? Does that
still apply to Access 2003?????

I gather : USE INDEXES WHEN:::

1. if the data in the field is different for each record
2. if you are likely to search or sort on the field
3. if there is another field X in the record that has more of the
characteristics above then field Y then don't bother creating a second
index.

How about date fields. They satisfy point 1 and point 2.

Is there any reason to index numeric fields????

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
"WindAndWaves" <ac****@ngaru.com> wrote in news:ScOwc.1058$GB4.35933
@news.xtra.co.nz:
Is there anyone who has some sound rules of thumb for using indexes.
Pretty old advice from
Microsoft® Jet Database Engine Programmer's Guide!
The last paragraph (is it still valid?) may describe an issue which can be
overlooked.

**** 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.
**** quote ****

--
Lyle
(for e-mail refer to http://ffdba.com/)

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004
Nov 13 '05 #3
On Mon, 7 Jun 2004 12:18:24 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

One additional reason for an index, and in particular a unique index:
to enforce a business rule stating that the values in this column
should be unique.

Data type has very little to do with whether or not you should apply
an index.

-Tom.

Ok,thanks for that, so does that mean that if someone is adding information
to a table with an index and someone is editing another record in the table
at the same time that then there will be concurrency issues????? Does that
still apply to Access 2003?????

I gather : USE INDEXES WHEN:::

1. if the data in the field is different for each record
2. if you are likely to search or sort on the field
3. if there is another field X in the record that has more of the
characteristics above then field Y then don't bother creating a second
index.

How about date fields. They satisfy point 1 and point 2.

Is there any reason to index numeric fields????

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
"WindAndWaves" <ac****@ngaru.com> wrote in news:ScOwc.1058$GB4.35933
@news.xtra.co.nz:
> Is there anyone who has some sound rules of thumb for using indexes.


Pretty old advice from
Microsoft® Jet Database Engine Programmer's Guide!
The last paragraph (is it still valid?) may describe an issue which can be
overlooked.

**** 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.
**** quote ****

--
Lyle
(for e-mail refer to http://ffdba.com/)

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004


Nov 13 '05 #4

yeah, definitely Tom (inderdaad).
---------------A----------------------
so you are saying that even for a field with a byte as fieldsize it may pay
to have an index?

Does the length of the table have any influence on whether or not you should
use an index????
---------------B----------------------
I often use indexes with multiple fields.

Where you need to have unique combinations.

For example, a table with the following fields:
1. contactID
2. contactGroupID

in such a table you store combinations of contacts and the groups they
belong too. To stop double entries, you make sure that you do not enter a
contact twice for one group.

Thanks for your point.

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:06********************************@4ax.com...
On Mon, 7 Jun 2004 12:18:24 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

One additional reason for an index, and in particular a unique index:
to enforce a business rule stating that the values in this column
should be unique.

Data type has very little to do with whether or not you should apply
an index.

-Tom.

Ok,thanks for that, so does that mean that if someone is adding informationto a table with an index and someone is editing another record in the tableat the same time that then there will be concurrency issues????? Does thatstill apply to Access 2003?????

I gather : USE INDEXES WHEN:::

1. if the data in the field is different for each record
2. if you are likely to search or sort on the field
3. if there is another field X in the record that has more of the
characteristics above then field Y then don't bother creating a second
index.

How about date fields. They satisfy point 1 and point 2.

Is there any reason to index numeric fields????

"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
"WindAndWaves" <ac****@ngaru.com> wrote in news:ScOwc.1058$GB4.35933
@news.xtra.co.nz:

> Is there anyone who has some sound rules of thumb for using indexes.

Pretty old advice from
Microsoft® Jet Database Engine Programmer's Guide!
The last paragraph (is it still valid?) may describe an issue which can be overlooked.

**** 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.
**** quote ****

--
Lyle
(for e-mail refer to http://ffdba.com/)

---
Please immediately let us know (by phone or return email) if (a) this

emailcontains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004
Nov 13 '05 #5

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

Similar topics

9
by: pheonix1t | last post by:
hello, I've been assigned to do performance tuning on an SQL2000 database (around 10GB in size, several instances). So far, I see a single RAID5 array, 4CPU (xeon 700MHZ), 4GB RAM. I see the...
4
by: mairhtin o'feannag | last post by:
Hello, I want to ask the question "how large is each of the indexes in a particular tablespace??" since I want to know which user-created indexes are taking up huge amounts of space. I used the...
4
by: robert | last post by:
my colleagues are convinced that having more than an index or two destroys performance on their batch runs. could be. i don't have the data, and i'm wondering whether there might be some...
3
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
10
by: Troels Arvin | last post by:
Hello, At http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems it's stated that DB2 doesn't have bitmap indexes. This seemed strange to me, so I tried looking in...
6
by: Chuck Van Den Corput | last post by:
I have an application with one main table with a jillion attributes. There are numerous other tables, but these are either children of the main table or lookup tables. I am finding that I am...
3
by: db2admin | last post by:
hi, our db2advis is broken and i am trying to find other ways to get recommended indexes i tried using command "SET CURRENT EXPLAIN MODE RECOMMEND INDEXES" and it populated ADVISE_INDEXES...
10
by: lesperancer | last post by:
you start with a small application in access97, then you have more modules and more... and you reach the point where tables like 'item' and 'employee' reach the limit and you know there's more...
3
by: skaushik | last post by:
Hi all, I ran an explain plan for a sql query which has some bind variables used in it. The plan shows that index is being used but the execution takes a very long time. Also, in another query the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
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,...
0
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...

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.