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 5 1839
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.ed oo> wrote in message
news:Pa******** ************@co mcast.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
Answered in microsoft.publi c.access.tabled esign
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in
news:42******** *************** @per-qv1-newsreader-01.iinet.net.au : Answered in microsoft.publi c.access.tabled esign
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
On Wed, 6 Jul 2005 16:00:49 -0700, "Bruce Rusk"
<br************ ***@stanford.ed oo> 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 documentatio n 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.
Bruce posted the same question under a different topic in the ms newsgroup.
The reply on server news.microsoft. com was:
news:e4******** ******@TK2MSFTN GP12.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********@bwa y.net.invalid> wrote in message
news:Xn******** *************** *********@24.16 8.128.90... "Allen Browne" <Al*********@Se eSig.Invalid> wrote in news:42******** *************** @per-qv1-newsreader-01.iinet.net.au :
Answered in microsoft.publi c.access.tabled esign
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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, then put the maxval partition back on. (I save the data that was in the maxval partition first and put it back in when I was done.
These tables...
|
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 in the database
3-Imports data using bulk insert
4-Analyzes data using stored procedures
I would like to improve the performance of the analysis...
|
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 books.
One says, that to get the best query performance, youi do two things:
|
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 raid5 as a bottleneck. I'd setup a raid 10 and seperate the
logs, database and OS(win2k).
The one thing that was a bit odd to me was that I was...
|
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 following query to
determine *WHICH* indexes are in the tablespace in question. Now I just
need to get the size of each of the indexes returned.
...
| |
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...
|
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 with the
transaction log. Performance is not the best, as you may imagine...
Next week we will add another 14 drives and organize them in...
|
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 indexes required for RI to come
does creating a RI programatically instead of the relationship window
still consume one of the 32 indexes ?
does...
|
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...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |