Re: indexes on primary and foreign keys

From: K C Lau <kclau60(at)netvigator(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: indexes on primary and foreign keys
Date: 2006-01-12 03:49:16
Message-ID: 6.2.1.2.0.20060112103712.0529cdd0@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

At 09:26 06/01/12, you wrote:

>On Jan 12, 2006, at 9:36 , K C Lau wrote:
>
>>>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?
>
>Set[1] your log_min_messages to WARNING or higher[2].
>
>[1](http://www.postgresql.org/docs/current/interactive/sql-set.html)
>[2](http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN)
>
>Michael Glaesemann
>grzm myrealbox com

Thanks. The side effect is that it would suppress other notices which might
be useful.

I was looking for a way to suppress the notice within the CREATE TABLE
statement but could not.
I noticed that when I specify a constraint name for the primary key, it
would create an implicit index with the constraint name. So may be if the
optional constraint name is specified by the user, then the notice can be
suppressed. Indeed the manual already says that the index will be
automatically created.

BTW, there's an extra space in link[2] above which I have removed.

Best regards,
KC.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Creager 2006-01-12 04:20:46 Re: Index isn't used during a join.
Previous Message Tom Lane 2006-01-12 03:23:55 Re: Extremely irregular query performance