Skip site navigation (1) Skip section navigation (2)

Re: Set maintenance work mem for pg_restore

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Deron <fecastle(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Set maintenance work mem for pg_restore
Date: 2007-12-18 20:54:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Dec 18, 2007 2:30 PM, Deron <fecastle(at)gmail(dot)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.

In response to

pgsql-admin by date

Next:From: Tom LaneDate: 2007-12-18 21:21:47
Subject: Re: Set maintenance work mem for pg_restore
Previous:From: Alvaro HerreraDate: 2007-12-18 20:49:57
Subject: Re: Set maintenance work mem for pg_restore

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group