473,395 Members | 1,437 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,395 software developers and data experts.

Redundancy of multifield indexes?

I have a question about indexing multiple fields and whether it's redundant
to index the individual fields separately.

As I understand it, if there is an index on two fields, say idxFullName
which includes LastName and FirstName, in that order, it would be redundant
to create a separate index on LastName since idxFullName would already be
indexing LastName. But it would be necessary to create a separate index for
FirstName to assist with searches on FirstName alone (e.g. for all "Bob"s or
"Mary"s regardless of surname).

My question is: does this apply to indexes that include three or more
fields?

For example, if I have a table with LastName, FirstName and MiddleName and
create an index on all three fields (in that order), and then do a search on
LastName = x and FirstName = y, will the Jet Engine be able to figure out
that it can use the first two fields of the index? Similarly, will this
three-field index also be helpful for searches covering just the LastName
field?

If anyone knows the answer (or can point me to someplace in the Access/Jet
documentation that I have overlooked), thanks in advance.

Bruce Rusk
Nov 13 '05 #1
5 1825
Hi Bruce,

I have a tblNames that has strFName strLName fields. I use four indexes on
this table:
LName = strLName
FName = strFName
LastName = strLName and strFName
FirstName = strFName and strLName

I search on both the first and last names or only on the first name or only
on the last name. The database has 10,000 names and the records are returned
instantly (PIII 600).

I do not specify an index and have even found that doing so can actually
slow the searches in general down. Which makes me think that Jet4 is smarter
than I am when it comes to selecting the best index.

Experience is the best teacher, just do a little experimenting.
Regards,
Barry

"Bruce Rusk" <br***************@stanford.edoo> wrote in message
news:Pa********************@comcast.com...
I have a question about indexing multiple fields and whether it's redundant
to index the individual fields separately.

As I understand it, if there is an index on two fields, say idxFullName
which includes LastName and FirstName, in that order, it would be
redundant
to create a separate index on LastName since idxFullName would already be
indexing LastName. But it would be necessary to create a separate index
for
FirstName to assist with searches on FirstName alone (e.g. for all "Bob"s
or
"Mary"s regardless of surname).

My question is: does this apply to indexes that include three or more
fields?

For example, if I have a table with LastName, FirstName and MiddleName and
create an index on all three fields (in that order), and then do a search
on
LastName = x and FirstName = y, will the Jet Engine be able to figure out
that it can use the first two fields of the index? Similarly, will this
three-field index also be helpful for searches covering just the LastName
field?

If anyone knows the answer (or can point me to someplace in the Access/Jet
documentation that I have overlooked), thanks in advance.

Bruce Rusk

Nov 13 '05 #2
Answered in microsoft.public.access.tabledesign
Nov 13 '05 #3
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:42***********************@per-qv1-newsreader-01.iinet.net.au:
Answered in microsoft.public.access.tabledesign


Why? The post was only posted here in CDMA.

I'd be interested to know how you answered it, since I'm pretty sure
that the number of indexes you need is N-1, where N is the number of
columns in the multi-column index.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4
On Wed, 6 Jul 2005 16:00:49 -0700, "Bruce Rusk"
<br***************@stanford.edoo> wrote:
I have a question about indexing multiple fields and whether it's redundant
to index the individual fields separately.

As I understand it, if there is an index on two fields, say idxFullName
which includes LastName and FirstName, in that order, it would be redundant
to create a separate index on LastName since idxFullName would already be
indexing LastName. But it would be necessary to create a separate index for
FirstName to assist with searches on FirstName alone (e.g. for all "Bob"s or
"Mary"s regardless of surname).

My question is: does this apply to indexes that include three or more
fields?

For example, if I have a table with LastName, FirstName and MiddleName and
create an index on all three fields (in that order), and then do a search on
LastName = x and FirstName = y, will the Jet Engine be able to figure out
that it can use the first two fields of the index? Similarly, will this
three-field index also be helpful for searches covering just the LastName
field?

If anyone knows the answer (or can point me to someplace in the Access/Jet
documentation that I have overlooked), thanks in advance.

Bruce Rusk


If I have, say, a 3-field identifier of some kind, I'll try to make an index
for the combination, and I'll make indexes for any individual fields I think
are highly likely to be searched or sorted individually. I'll make the first
field of the multi-field index -not- be one of those because then the
multi-field index can at leas be some help in the less common case, though
it's bigger and therefore slower to search than the single-field indexes. Be
careful not to go overboard because more indexes adds to the time it takes to
do updates and increases the likelihood of multi-user lock conflicts. For
fields less commonly searched on, it may be better to use no index and live
with the table scan penalty for those.

I have some uncertainty about how clever Access can get in using indexes
because I know that SQL Server can be really damn clever. For instance, if
I'm searching on the second field in a multi-field index, SQL Server may still
use the index even though it has to do a full scan of it because the estimated
number of reads is still smaller that way than doing the full scan of the
table first. I don't know if Access/Jet does that kind of optimization or
not.
Nov 13 '05 #5
Bruce posted the same question under a different topic in the ms newsgroup.

The reply on server news.microsoft.com was:
news:e4**************@TK2MSFTNGP12.phx.gbl

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn********************************@24.168.128 .90...
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:42***********************@per-qv1-newsreader-01.iinet.net.au:
Answered in microsoft.public.access.tabledesign


Why? The post was only posted here in CDMA.

I'd be interested to know how you answered it, since I'm pretty sure
that the number of indexes you need is N-1, where N is the number of
columns in the multi-column index.

Nov 13 '05 #6

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

Similar topics

0
by: Paul | last post by:
I'm confused about something I did this week. I have an 8.1.7.4 database with tables partitioned by dates. I recently dropped my maxvalue tablespace, added a few more partitions for up-coming dates,...
2
by: Chris | last post by:
Any help would be appreciated. I am running a script that does the following in succession. 1-Drop existing database and create new database 2-Defines tables, stored procedures and functions...
1
by: Steve_CA | last post by:
Hi, The more I read, the more confused I'm getting ! (no wonder they say ignorance is bliss) I just got back from the bookstore and was flipping through some SQL Server Administration...
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...
14
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...
17
by: boa | last post by:
I'm currently planning disk layouts and use for a new version of our database. The current version has all data and indexes in the default filegroup, placed on one big raid-5 array(6 drives) along...
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...
0
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...

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.