Re: Primary key vs unique index

From: "Voils, Steven M" <steve(at)sensorswitch(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Primary key vs unique index
Date: 2011-03-17 18:59:58
Message-ID: 856778F98E4F4B4F896F2B70C8164A3437FA9D7FE9@EXCHANGE-MBX2.AcuityLightingGroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for the reply. I should have mentioned in the first post that we do delete significant amounts of the table which I thought was the cause of the bloat. We are already performing automatic vacuums nightly.

-----Original Message-----
From: Scott Marlowe [mailto:scott(dot)marlowe(at)gmail(dot)com]
Sent: Thursday, March 17, 2011 2:52 PM
To: Voils, Steven M
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Primary key vs unique index

On Thu, Mar 17, 2011 at 12:51 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> On Thu, Mar 17, 2011 at 6:19 AM, Voils, Steven M <steve(at)sensorswitch(dot)com> wrote:
>> Is there a fundamental difference between a primary key and a unique index?
>> Currently we have primary keys on tables that have significant amounts of
>> updates performed on them, as a result the primary key indexes are becoming
>> significantly bloated.  There are other indexes on the tables that also
>> become bloated as a result of this, but these are automatically rebuild
>> periodically by the application (using the concurrently flag) when read
>> usage is expected to be very low.
>
> If you're experiencing bloat, but not deleting huge chunks of your
> table at a time, then you're not vacuuming aggressively enough

Or you're on 8.3 or before and blowing out your free space map.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2011-03-17 19:32:00 Re: query taking much longer since Postgres 8.4 upgrade
Previous Message Voils, Steven M 2011-03-17 18:59:00 Re: Primary key vs unique index