pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
Cc: Lista Postgres <pgsql-admin@postgresql.org>
Subject: Re: Should duplicate indexes on same column and same tablebe allowed?
Date: Mon, 11 Dec 2006 19:30:27 +0000
Message-ID: <1165865427.3816.90.camel@silverbirch.site> (raw)
In-Reply-To: <18891.1165686391@sss.pgh.pa.us>
References: <a97c77030612082203j5b1dac19i96ef9932d60f375e@mail.gmail.com>
	<8397.1165647371@sss.pgh.pa.us>
	<a97c77030612082307l10eee309n6bd8ad15e992b3c2@mail.gmail.com>
	<a97c77030612082320v733b0bbav5ed2828edbc95a8d@mail.gmail.com>
	<18891.1165686391@sss.pgh.pa.us>

On Sat, 2006-12-09 at 12:46 -0500, Tom Lane wrote:
> "Rajesh Kumar Mallah" <mallah.rajesh@gmail.com> writes:
> > Suppose an index get corrupted. And you need create a new index
> > with exact specs and then drop the old index. Is it better to
> > have a performing corrupted index or not have it at all and temporarily
> > suffer some performance degradation ?
> 
> The case that was being discussed just a day or two ago was where you
> wanted to do the equivalent of REINDEX because of index bloat, not any
> functional "corruption".  In that case it's perfectly clear that
> temporarily not having the index isn't acceptable ... especially if
> it's enforcing a unique constraint.

I can see that is quite handy.

However, I can't see any benefit to allowing multiple FKs:

postgres=# alter table accounts add foreign key (bid) references
branches;
ALTER TABLE
Time: 1678.240 ms
postgres=# alter table accounts add foreign key (bid) references
branches;
ALTER TABLE
Time: 909.706 ms
postgres=# alter table accounts add foreign key (bid) references
branches;
ALTER TABLE
Time: 507.673 ms
postgres=# alter table accounts add foreign key (bid) references
branches;
ALTER TABLE
Time: 597.909 ms
postgres=# alter table accounts add foreign key (bid) references
branches;
ALTER TABLE
Time: 677.125 ms
postgres=# \d accounts
    Table "public.accounts"
  Column  |  Type   | Modifiers
----------+---------+-----------
 aid      | integer | not null
 bid      | integer |
 abalance | integer |
Indexes:
    "accounts_pkey" PRIMARY KEY, btree (aid)
Foreign-key constraints:
    "accounts_bid_fkey" FOREIGN KEY (bid) REFERENCES branches(bid)
    "accounts_bid_fkey1" FOREIGN KEY (bid) REFERENCES branches(bid)
    "accounts_bid_fkey2" FOREIGN KEY (bid) REFERENCES branches(bid)
    "accounts_bid_fkey3" FOREIGN KEY (bid) REFERENCES branches(bid)
    "accounts_bid_fkey4" FOREIGN KEY (bid) REFERENCES branches(bid)


-- 
  Simon Riggs             
  EnterpriseDB   http://www.enterprisedb.com





view thread (13+ messages)  latest in thread

Message-ID: <1165865427.3816.90.camel@silverbirch.site>
Permalink:  ../1165865427.3816.90.camel@silverbirch.site/
Also on:    postgresql.org/message-id/1165865427.3816.90.camel@silverbirch.site

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: simon@2ndquadrant.com, tgl@sss.pgh.pa.us, mallah.rajesh@gmail.com
  Subject: Re: Should duplicate indexes on same column and same tablebe allowed?
  In-Reply-To: <1165865427.3816.90.camel@silverbirch.site>
  References: <a97c77030612082203j5b1dac19i96ef9932d60f375e@mail.gmail.com> <8397.1165647371@sss.pgh.pa.us> <a97c77030612082307l10eee309n6bd8ad15e992b3c2@mail.gmail.com> <a97c77030612082320v733b0bbav5ed2828edbc95a8d@mail.gmail.com> <18891.1165686391@sss.pgh.pa.us> <1165865427.3816.90.camel@silverbirch.site>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox