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

Indexing Question

Can someone set me straight I know indexing is a "try & see" art.
However I am at a loss if it's better to use the INCLUDE switch on a
unique index and tag on the columns be used to avoid a lookup on the
disk. Or if it's better to use all of the columns as part of the index?
One more question, is it a good idea to always have the PK of the table
as part of any index created on a table? The querys don't actualy use
the PK column in their "where" clause, and the act of created a PK
automaticaly creates an index anyways. Any replys much appreciated!

Nov 12 '05 #1
2 1236
<Ke*********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Can someone set me straight I know indexing is a "try & see" art.
However I am at a loss if it's better to use the INCLUDE switch on a
unique index and tag on the columns be used to avoid a lookup on the
disk. Or if it's better to use all of the columns as part of the index?
One more question, is it a good idea to always have the PK of the table
as part of any index created on a table? The querys don't actualy use
the PK column in their "where" clause, and the act of created a PK
automaticaly creates an index anyways. Any replys much appreciated!


The unique index created by the PK is how DB2 guarantees that the PK is
unique. If an existing unique index exists before you create the PK, then
DB2 will use it instead of creating another one.

The decision to use the INCLUDE clause depends partly on how many extra
columns and how large they are. You could put all the table columns in an
index with the INCLUDE, and that might speed up some queries, but it will
slow down inserts, updates, deletes, and data loads.
Nov 12 '05 #2
Have you tried submitting the query or a group of queries to the DB2 Advisor
tool.
It would tell you if you need which,what,where indexes and whether include
should be used.

Submit your key queries to your system. launch the DB2 Advisor Wizard from
the Control Centre and see what it recommends.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"Mark A" <no****@nowhere.com> a écrit dans le message de news:
TN******************************@comcast.com...
<Ke*********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Can someone set me straight I know indexing is a "try & see" art.
However I am at a loss if it's better to use the INCLUDE switch on a
unique index and tag on the columns be used to avoid a lookup on the
disk. Or if it's better to use all of the columns as part of the index?
One more question, is it a good idea to always have the PK of the table
as part of any index created on a table? The querys don't actualy use
the PK column in their "where" clause, and the act of created a PK
automaticaly creates an index anyways. Any replys much appreciated!


The unique index created by the PK is how DB2 guarantees that the PK is
unique. If an existing unique index exists before you create the PK, then
DB2 will use it instead of creating another one.

The decision to use the INCLUDE clause depends partly on how many extra
columns and how large they are. You could put all the table columns in an
index with the INCLUDE, and that might speed up some queries, but it will
slow down inserts, updates, deletes, and data loads.


Nov 12 '05 #3

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

Similar topics

1
by: Chuck Chekuri | last post by:
Hi, We have a 3TB oracle db. 24x7 operation with data constantly coming in to the DB. Users from all over the world use a web based applicaton to query and work on the data. Out transaction...
1
by: Danny | last post by:
sorry for posting a question that has probably been posted hundreds of times, but i can't seem to find the answer i need...We're using a Sql Server 7.0 database and recently started getting timeout...
1
by: Thomas Bartkus | last post by:
If we have a date/time field and are doing frequent queries WHERE {date/time field} BETWEEN TimeA AND TimeB Does it make sense, query speed wise, to create an index on the date/time field? ...
108
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
1
by: Chuck Chekuri | last post by:
Hi, We have a 3TB oracle db. 24x7 operation with data constantly coming in to the DB. Users from all over the world use a web based applicaton to query and work on the data. Out transaction...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.