473,473 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Column order of an Index

Does the column order in an index matter? Currently i have an index
with the columns in the following order: Type, Product_oid. If i
create a new index with the columns in the reverse order: Product_oid,
type will it make a difference? Also what is the best way to tell if
an index is being used (I am using DB2 UDB v8.1.5 for Windows). Thanks
in advance..

Nov 12 '05 #1
1 2757
cmitchell wrote:
Does the column order in an index matter? Currently i have an index
with the columns in the following order: Type, Product_oid. If i
create a new index with the columns in the reverse order: Product_oid,
type will it make a difference? Also what is the best way to tell if
an index is being used (I am using DB2 UDB v8.1.5 for Windows). Thanks
in advance..

It absolutely matters.
DB2 can still exploit an index if only the first n-elements apear in the
query. That implied that columns which are not often accessed, yet you
want them to be part of the index, should be at the end.
All things being equal it is benefiical to place the column with the
highest selectivity in the front.
So: (Gender, Name) would be really bad :-)

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

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

Similar topics

2
by: carmen | last post by:
I'm using the code below to display the results in rows with the column header as hyperlinks that will sort the rows by colum heading. Is there a way to have the results sorted (as default) in...
2
by: Danny | last post by:
Is there any way to update a column in a clustered index without incurring the cost of reordering. Example: Create table TableX ( Col1 int, Col2 smalldatetime, Col3 varchar(10)) go create...
9
by: Rick | last post by:
I've created a clustered two column index on a table where the second column is an integer value. When the first column is the same, instead of ordering in numerical order it is ordering...
2
by: VR | last post by:
Is there any to right-justify the 0th (main/item's) column in ListView? I have a ListView control, which I send a LVM_SETCOLUMNORDERARRAY message to change the order of columns. Neither before...
4
by: Steph. | last post by:
I have a List view displaying data in Detail mode with several columns. How I can get the column index the user clicked on ? (when user click on an item inside the ListView, not on a column...
1
by: wapsiii | last post by:
is it possible to sort a dataview by a column index? Instead of this: dv.Sort = "Id"; I'd like to do this: dv.Sort = 0; // where 0 is column index /M
11
by: surya | last post by:
hello sir, i have a table emp ,it has three fields one is empno int ,second is ename varchar(20). and last is salary , emp empno ename salary ----------- ------------...
2
by: musicbizguy | last post by:
Hello everyone. I'm a noob to MySql, so I'm hoping this is easy and I apologise in advance if I've got the terminology all wrong; I've searched the forum but couldn't find an answer. I have a...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
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
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.