General Advice for avoiding concurrency during schema migrations

From: Ken Barber <ken(at)bob(dot)sh>
To: pgsql-general(at)postgresql(dot)org
Subject: General Advice for avoiding concurrency during schema migrations
Date: 2014-03-21 17:46:29
Message-ID: CAGf7y=rkwaix+tuvDdadSLSeu4Got8T7yihXzcJ0EW3Fj3K=VQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

I was just wondering if anyone has some general advice for how to
ensure a schema migration for an application has exclusivity during
its run.

This is to avoid silly things like, if someone leaves an application
server running during migration the migration should be able to lock
somehow to avoid any changes while it is running.

I've taken a look at LOCK TABLE, which can lock a table obviously (and
I can obviously lock _all_ tables to fake a LOCK DATABASE), but I'm
wondering if someone has some opinion around just raising the
transaction isolation level to achieve similar goals?

Any lessons learnt and best practices would be much appreciated :-).

ken.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2014-03-21 18:51:49 Re: Passing array of range literals
Previous Message Rich Shepard 2014-03-21 17:35:21 Re: Upgrade: 9.0.5->9.4