Let's say I have a table (I, do they are very cheap these days)
The table has a composit primary key:

create table (
 a int not null,
 b int not null,
 c int not null,

... more columns here.

 primary key(a,b)
)

Now, it just so happens that a is a foreignkey that I'd like to look up
rows by quite often, so the natural thing to do here is to create an
index on a...

However, I have this idea; that because a is the first column of an
index already, that this index will be just as fast as an index just for
a, but is it?

What do I need to think about before re-using an index like this?
 You don't need to maintain an extra index.
 If the other index is very large it could be a loss to wade through it.
 If the other index is used a lot then it would more likely be in cache.

At the moment I don't generate indexes for columns that are already
indexed as the first column of another index (primary key or one created
manually), I think this is a winning strategy, but what do other people
think?

-- 
 Regards Flemming Frandsen aka. Dion/Swamp http://dion.swamp.dk
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to