Re: page locking? too many btree indexes...

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Brian Maguire <bmaguire(at)vantage(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: page locking? too many btree indexes...
Date: 2004-10-27 17:59:00
Message-ID: 20041027175900.GB5394@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 26, 2004 at 11:44:42AM -0400, Brian Maguire wrote:
> Can too many btree indexes cause page level locking?

Yes, too many btree indexes can, as can a single btree index.

> I am experiencing locking related on two tables. Each has several
> indexes on it (4 or more). One table is frequently updated (20%),
> occasional inserts(10%), and many reads (70%) and the other has many
> inserts and reads every 20 secs.

Most likely, your problem is not related to the indexes. Yes, there is
page-level exclusive locking on the indexes when there's insert or
delete operations going on, but they don't cause deadlocks. The likely
cause of your problem is foreign key relationships. Those are
implemented using row-level exclusive locking, and they can (and often
do) cause deadlocks.

Do you have any foreign keys defined?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Porque Kim no hacia nada, pero, eso sí,
con extraordinario éxito" ("Kim", Kipling)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2004-10-27 18:01:46 Re: Array values and foreign keys
Previous Message nd02tsk 2004-10-27 17:47:03 Re: Reasoning behind process instead of thread based