Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Index and column ordinal position

Posted on 2006-07-18
3
Medium Priority
?
3,079 Views
Last Modified: 2007-12-19
Hi experts,

I recently added a new column to an existing table using
Alter table star12 add ID_GRP_RISK char(12)

The new field appears in last position when I run a desc on the table.

Now I need to create a new PK / Unique index using both the first column and the newly created one. Should column position be a concern.

I remember from my (old ;-) ) oracle days that column position might affect performances. I don't have the slightest idea if the version I use now (9i) has changed anything reagrding this column ordering.

Would a REORG be sufficient to get decent performances (after changing the unique index / primary key)

NB : dropping/creating the table to change its stucture was not an option.

Any comments welcome (I know I could find this kind of information on the net or simply browsing the KB .. I'm not lazy but my current mission does not leave me much time)

Hilaire
0
Comment
Question by:Hilaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 17130380
>Now I need to create a new PK / Unique index using both the first column and the newly created one. Should column position be a concern.
no. PK and indexes can be created on any column, whatever position they have in the table.
0
 
LVL 19

Expert Comment

by:actonwang
ID: 17130492
>>. Should column position be a concern.

      only the order you put into "create index ... on table1(col1,col2)" matters.
0
 
LVL 35

Assisted Solution

by:johnsone
johnsone earned 400 total points
ID: 17130610
That was always done for a few.

The first is looks.  The table looks better in the describe if the key fields are first.

They used to claim that there was a neglible performance increase in indexing if the key fields were first.  I never heard of anyone proving it though.

The biggest was storage.  Since disk is cheap now and storage is structured so much differently, that is not a concern anymore.

The storage savings is due to the fact that Oracle does not store trailing null columns.  This is why they had always suggested that all not null columns come first in the table.  Take these 2 tables for example:

test1 has columns a, b, and c.   a and c are not null and b is nullable.

test2 has columns a, c,  and b.  a and c are not null and b is nullable.

If b is null in test1, Oracle has to store a 1 byte length in the record.  If b is null in test2, nothing is stored in its place.

Over the course of millions of records and multiple columns, the space usage can add up.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question