Re: primary key index

From: Frank <fvanbortel_at_netscape.net>
Date: Mon, 24 Feb 2003 20:33:42 +0100
Message-ID: <3E5A7396.9030006_at_netscape.net>


iskon.hr wrote:
> hello,
>
>
> using usual general data in select statement from table like :
> 1. primary key
> 2. names
> 3. code
> 4. some kind of general info... etc
>
>
> tells me to expand primary key with these values!
> (because B-tree index take values of column).
> But, in the other hand I have primary key and declaring same index twice
> (pk,col1,col2...) is not smart decision!
>
> Any suggestions???
>
>
> MB
>
>

Not sure what you mean. Adding columns to your primary key? If you have the need to do so, your model was bad to start with (or it has severely changed, of course).

Adding indexes? Is not the cure for all problems. Inserts will be slower; compary a table with just a primary key to a table with 23 indexes, one of these being the primry key.

You can add an index, but is is not neccesary to do if the columns are already in an index. It may help performance selecting an extra, not needed, field if that will make the query use an index.

-- 
Regards, Frank van Bortel
Received on Mon Feb 24 2003 - 20:33:42 CET

Original text of this message