Re: indexes on primary and foreign keys

От: K C Lau
Тема: Re: indexes on primary and foreign keys
Дата: ,
Msg-id: 6.2.1.2.0.20060112083033.02bb74c8@localhost
(см: обсуждение, исходный текст)
Ответ на: Re: indexes on primary and foreign keys  (Michael Fuhr)
Ответы: Re: indexes on primary and foreign keys  (Michael Glaesemann)
Список: pgsql-performance

Скрыть дерево обсуждения

indexes on primary and foreign keys  (Burak Seydioglu, )
 Re: indexes on primary and foreign keys  (Tom Lane, )
 Re: indexes on primary and foreign keys  (Michael Fuhr, )
  Re: indexes on primary and foreign keys  (Burak Seydioglu, )
  Re: indexes on primary and foreign keys  (K C Lau, )
   Re: indexes on primary and foreign keys  (Michael Glaesemann, )
    Re: indexes on primary and foreign keys  (Michael Fuhr, )
    Re: indexes on primary and foreign keys  (K C Lau, )
     Re: indexes on primary and foreign keys  (Tom Lane, )

At 07:21 06/01/12, Michael Fuhr wrote:
>On Wed, Jan 11, 2006 at 02:38:42PM -0800, Burak Seydioglu wrote:
> > I do a load of sql joins using primary and foreign keys. What i would like
> > to know if PostgreSQL creates indexes on these columns automatically (in
> > addition to using them to maintain referential integrity) or do I have to
> > create an index manually on these columns as indicated below?
> >
> > CREATE TABLE cities (
> >   city_id integer primary key,
> >   city_name varchar(50)
> > );
> >
> > CREATE INDEX city_id_index ON cities(city_id);
>
>PostgreSQL automatically creates indexes on primary keys.  If you run
>the above CREATE TABLE statement in psql you should see a message to
>that effect:
>
>NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
>"cities_pkey" for table "cities"

Is there a way to suppress this notice when I create tables in a script?

Best regards,
KC.




В списке pgsql-performance по дате сообщения:

От: Tom Lane
Дата:
Сообщение: Re: indexes on primary and foreign keys
От: Simon Riggs
Дата:
Сообщение: Re: Extremely irregular query performance