pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Deron <fecastle@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Set maintenance work mem for pg_restore
Date: Tue, 18 Dec 2007 14:54:07 -0600
Message-ID: <dcc563d10712181254q326c758dv6aa02d924ef585d5@mail.gmail.com> (raw)
In-Reply-To: <ad143ba80712181230q3b5002b5wa1a90b304ef0e2f2@mail.gmail.com>
References: <ad143ba80712181230q3b5002b5wa1a90b304ef0e2f2@mail.gmail.com>

On Dec 18, 2007 2:30 PM, Deron <fecastle@gmail.com> wrote:
> I see a lot of suggestions to increase maintenance work mem if running
> pg_restore.  This is to help with the index creation and initial sort from
> what I understand.  A few tests I ran does show this helps.
> Does anyone know if there is a way to only "temporarily" set this setting?
> I have some DBs that are bloated and I have a script to run off hours (I
> don't like working late).  This uses pg_dump and pg_restore to recover the
> disk space.  I found that this is usually faster than 'vacuum full', and is
> useful in some cases.
>
> I know I can set this for my current session dynamically "set
> maintenance_work_mem = xxxxx", but it seems that the only way I can do this
> for pg_restore is to update the configuration, reload and then change it
> back when the script completes and reload again.

If you use psql to restore, you can just add the set
maintenance_work_mem = xxx at the top of the file.

Also you can do it by creating a "special" superuser and altering that
user to inherit this new setting:

create user bubba superuser;
alter user bubba set maintenance_work_mem TO 512000;

then just connect as that user to run your restores or what not.  You
can also set it for a non-super user, or a database as well.



view thread (5+ messages)  latest in thread

Message-ID: <dcc563d10712181254q326c758dv6aa02d924ef585d5@mail.gmail.com>
Permalink:  ../dcc563d10712181254q326c758dv6aa02d924ef585d5@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10712181254q326c758dv6aa02d924ef585d5@mail.gmail.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, fecastle@gmail.com
  Subject: Re: Set maintenance work mem for pg_restore
  In-Reply-To: <dcc563d10712181254q326c758dv6aa02d924ef585d5@mail.gmail.com>

* 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