Page 1 of 1

Postgres Primary Key

Posted: Mon Mar 29, 2004 11:40 pm
by phppick
Hi,

Can anybody tell me, what is this means..

this is i am getting when i am adding primary key

NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "tablename_pkey" for table "tablename"

Thanks

Posted: Tue Mar 30, 2004 2:24 am
by CoderGoblin
Indexes are primarily used to enhance database performance (though inappropriate use will result in slower performance).

As primary keys are unique and do not depend on other tables they can speed up query access to the table by having the index in place hence they are automatically added. You can also add additional indexes with the "CREATE INDEX" command (See http://www.postgresql.org/docs/7.4/inte ... index.html).

Too many or incorrectly indexed columns can degrade performance.

It is customary to run a "Vacuum analyse" on the database at regular intervals (cron job) to tidy up the indexes.

This sort of detail should be covered anywhere dealing with database management but at the moment I cannot point you to a specific reference point.