Re: Join Table
От | Tom Lane |
---|---|
Тема | Re: Join Table |
Дата | |
Msg-id | 14976.1099328858@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Join Table (T E Schmitz <mailreg@numerixtechnology.de>) |
Список | pgsql-sql |
T E Schmitz <mailreg@numerixtechnology.de> writes: > CREATE TABLE SUPPLY > ( > ITEM_FK integer NOT NULL, > CONTACT_FK integer NOT NULL, > COST numeric (7,2), > PRIMARY KEY (ITEM_FK,CONTACT_FK) > ); > Question: is it necessary/advisable to create an index for the ITEM_FK > column? Or is this redundantbecause this column is already one of the PK > columns? The PK index will be usable for searches on ITEM_FK alone (though *not* for searches on CONTACT_FK alone --- a moment's thought about the index sort order should convince you why). It would be marginally less efficient for this purpose than a dedicated index on ITEM_FK. But unless your use of this table is almost all searches and hardly any modifications, adding a dedicated index is probably a net loss due to the added update costs. regards, tom lane
В списке pgsql-sql по дате отправления: