Re: shared memory/max_locks_per_transaction error

From: "Kynn Jones" <kynnjo(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: shared memory/max_locks_per_transaction error
Date: 2008-03-17 14:30:27
Message-ID: c2350ba40803170730x3b4f53e4u8499555b99791977@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 14, 2008 at 7:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "Kynn Jones" <kynnjo(at)gmail(dot)com> writes:
> > Initially I didn't know what our max_locks_per_transaction was (nor even
> a
> > typical value for it), but in light of the procedure's failure after
> 3500
> > iterations, I figured that it was 3500 or so. In fact ours is only 64
> (the
> > default), so I'm now thoroughly confused.
>
> The number of lock slots available system-wide is
> max_locks_per_transaction times max_connections, and your procedure was
> chewing them all. I suggest taking the hint's advice if you really need
> to create 3500 tables in a single transaction. Actually, you'd better
> do it if you want to have 3500 tables at all, because pg_dump will
> certainly try to acquire AccessShare lock on all of them.

OK, in light of this, I'll have to either change my strategy (and schema)
significantly or greatly increase max_locks_per_transaction.

I'm leaning towards the re-design option, primarily because I really don't
really understand the consequences of cranking up max_locks_per_transaction.
E.g. Why is its default value 2^6, instead of, say, 2^15? In fact, why is
there a ceiling on the number of locks at all? I'm guessing that the fact
that the default value is relatively small (i.e. a couple of orders of
magnitude below the number of tables I have in mind) suggests that setting
this value to a huge number would be a terrible idea. Is that so?

Thanks!

Kynn

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-03-17 14:55:30 Re: shared memory/max_locks_per_transaction error
Previous Message Erik Jones 2008-03-17 14:26:35 Re: postgre vs MySQL