Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQKlN-000573-Sm for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2019 23:53:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hQKlK-0003Zt-G0 for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2019 23:53:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQKlJ-0003Zk-IY for pgsql-general@lists.postgresql.org; Mon, 13 May 2019 23:53:42 +0000 Received: from mail-oln040092008089.outbound.protection.outlook.com ([40.92.8.89] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQKlF-0001DC-93 for pgsql-general@lists.postgresql.org; Mon, 13 May 2019 23:53:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4iXqgaiZOPT2L/9TY2u/51QY+XjBELBnT6jokEM4epg=; b=HItDfDoqzvg1mzXuTgHc9Y4rjMK/lJd/ijuh8lZanjNZe7aFdUm8Ak4QCU9I7X8hABboZlR7WCOfzYrzlQK+Q0BJuToGQ2uv53EiNCcFpGb3syxI7tWrkF+ANWlEluliW8acsZC4BEpxVCEfPvvtP3RoMOYgM4TfnvlSYpznkGUGfrqvOobaDpV4biwrqVbjSpypRPwYimO4cGO+wX6oMYINgZW0oAkLCHRX4AFaxNcOv1TbPJ1HmJy4givHlW49KQFfudHoevBma3JJnmLZmKL8ZJj1TYB6SnhOQTK7/VhuXJf6nrTmcszcftzwpmHiJwT4ODLq+OMRvxBO0L0UOw== Received: from DM3NAM03FT026.eop-NAM03.prod.protection.outlook.com (10.152.82.58) by DM3NAM03HT175.eop-NAM03.prod.protection.outlook.com (10.152.82.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.11; Mon, 13 May 2019 23:53:33 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com (10.152.82.57) by DM3NAM03FT026.mail.protection.outlook.com (10.152.82.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.11 via Frontend Transport; Mon, 13 May 2019 23:53:33 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::d9fb:bca2:3018:3513]) by BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::d9fb:bca2:3018:3513%5]) with mapi id 15.20.1878.024; Mon, 13 May 2019 23:53:33 +0000 From: Julie Nishimura To: Adrian Klaver , "pgsql-general@lists.postgresql.org" , pgsql-general Subject: Re: does postgresql backup require additional space on disk Thread-Topic: does postgresql backup require additional space on disk Thread-Index: AQHVCbR8xRr2tap2vUK4vEBtNw+ap6ZpXXoAgAASmuSAAAw+AIAAAtZogAAYagCAAAmg0YAAE84AgAAFqXw= Date: Mon, 13 May 2019 23:53:33 +0000 Message-ID: References: <86c77c15-c089-a7fb-53d8-a6c14c9cd28a@aklaver.com> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:2D320E0B4F0FCDFAFA1A6E049F716F2461BCD1E49ED063DE07213766CF452B7C;UpperCasedChecksum:78EC6F265FD14D0CD5C00ED19D9FF0F0268BB33F2DE683DB0026B4FB0E14CDA3;SizeAsReceived:7405;Count:43 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [8rWYf0UYxKjGjL1QtmBwXjTSGGqwQ+h8] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);SRVR:DM3NAM03HT175; x-ms-traffictypediagnostic: DM3NAM03HT175: x-ms-exchange-purlcount: 4 x-microsoft-antispam-message-info: CDcdgW2T2PRYvdyw3yr6vjvD2I4j7P91DnWbo93ymi6izRrMdB8eGUrru41PQlZunIoWz+cKWUDQYcLZsqCvWxgB9tG1gni2KR20m8R0Vo3CrlUSLTJoCX3TG6PBbbB1NKfcqYVgDCEERIyWeI97XObBmuy9RwCIn1wFnnszBbMLOWAKlEQxs6uWnrlpwfFG Content-Type: multipart/alternative; boundary="_000_BYAPR08MB50146EEF3401259093DA929BAC0F0BYAPR08MB5014namp_" MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: cec0a142-31bc-42d1-f687-08d6d7fe3552 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2019 23:53:33.4788 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3NAM03HT175 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_BYAPR08MB50146EEF3401259093DA929BAC0F0BYAPR08MB5014namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Adrian, I think in my first emails in this chain about the effort i did specified i= t properly: CREATE TABLESPACE vol4 > OWNER postgres > LOCATION '/data/vol4'; > > ALTER DATABASE user_db_1 > SET default_tablespace =3D 'vol4'; > > ...for all dbs.. Then "default" part got lost in emails...:) ________________________________ From: Adrian Klaver Sent: Monday, May 13, 2019 4:33 PM To: Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-general Subject: Re: does postgresql backup require additional space on disk On 5/13/19 3:27 PM, Julie Nishimura wrote: > Adrian, thanks for your reply. I previously found this link, which > mentioned 8.2, that is why I assumed it will work with 8.3. No, what the link showed is: ALTER DATABASE mydatabase SET default_tablespace =3D mynewtablespace That is is the same as changing default_tablespace in postgresql.conf. It is not the same as: ALTER DATABASE name SET TABLESPACE > > Too bad we don't have dev with the same version. I guess I will create You can use the same commands on dev to test, just not ALTER DATABASE name SET TABLESPACE as that is not in 8.3. > new tablespace using new vol, move the smallest db for which I have You cannot move a db as a unit, you will need to move the individual tables/indexes in the db. > backup, create new test table and examine new/existing tables if they > have moved by selecting tablespace from pg_tables... right? Assuming you either specify the new tablespace on table CREATE or have set default_tablespace to the new tablespace. > > > http://www.postgresonline.com/journal/archives/123-Managing-disk-space-us= ing-table-spaces.html > Managing disk space using table spaces - Postgres OnLine Journal - > Postgres OnLine Journal Magazine Jul 2017 - Dec 2017 > > Below are steps to creating one. First create a folder on an available > disk in your filesystem using an filesystem server administrative login; > Next give full rights to the postgres server account (the one the daemon > process runs under) or you can change the owner of the folder to the > postgres account (in linux you can use chown postgres and on windows > just use the administrative properties ... > www.postgresonline.com > > > > ------------------------------------------------------------------------ > *From:* Adrian Klaver > *Sent:* Monday, May 13, 2019 2:47 PM > *To:* Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-general > *Subject:* Re: does postgresql backup require additional space on disk > On 5/13/19 1:26 PM, Julie Nishimura wrote: >> Adrian, thanks for your reply. Couple of clarifications/questions: >> 1) we are on 8.3 for this server > > 8.3 does not have ALTER DATABASE name SET TABLESPACE : > > https://www.postgresql.org/docs/8.3/sql-alterdatabase.html > > It does appear until 8.4. > > >> 2) I was under impression, that "ALTER DATABASE name SET TABLESPACE >> new_tablespace" won't move anything, and just utilize the new_tablespace >> for new tables/indexes. If we would want to move existing tables, we >> would need to move them one by one by > > No think of ALTER DATABASE name SET TABLESPACE as a bulk operation of > ALTER TABLE /mytableschema.mytable/ SET TABLESPACE /mynewtablespace/ > across all existing tables. This assumes the all existing tables live > in the current default tablespace. It is moot in your case as 8.3 is > not capable of doing this. > >> ALTER TABLE /mytableschema.mytable/ SET TABLESPACE /mynewtablespace/ >> / >> / > > The above is your option in 8.3. > >> 3) I thought if I want to have any newly created dbs go to the new vol, >> I need to alter template. > > It is not required you can spec the tablespace in the CREATE DATABASE > command: > > https://www.postgresql.org/docs/8.3/sql-createdatabase.html > > Though you can move them to make the tablespace the default. See above li= nk. > > >> 4) I was also thinking about changing parameters in config file to point >> to the newly volume and reload postgresql.conf >> >> default_tablespace >> >> temp_tablespaces > > You could that. If you do it, moving the template tables would be redunda= nt. > >> >> >> Am I wrong here? >> >> >> Thanks, >> >> Julie >> >> > > > -- > Adrian Klaver > adrian.klaver@aklaver.com -- Adrian Klaver adrian.klaver@aklaver.com --_000_BYAPR08MB50146EEF3401259093DA929BAC0F0BYAPR08MB5014namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Adrian,
I think in my first emails= in this chain about the effort i did specified it properly:

CREATE TABLESPACE vol4
> OWNER postgres
> LOCATION '/data/vol4';
>
> ALTER DATABASE user_db_1
> SET default_tablespace =3D 'vol4';
>
> ...for all dbs..

Then "default" p= art got lost in emails...:)



From: Adrian Klaver <a= drian.klaver@aklaver.com>
Sent: Monday, May 13, 2019 4:33 PM
To: Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-gener= al
Subject: Re: does postgresql backup require additional space on disk=
 
On 5/13/19 3:27 PM, Julie Nishimura wrote:
> Adrian, thanks for your reply. I previously found this link, which > mentioned 8.2, that is why I assumed it will work with 8.3.

No, what the link showed is:

ALTER DATABASE mydatabase SET default_tablespace =3D mynewtablespace

That is is the same as changing default_tablespace in postgresql.conf.

It is not the same as:

ALTER DATABASE name SET TABLESPACE

>
> Too bad we don't have dev with the same version. I guess I will create=

You can use the same commands on dev to test, just not ALTER DATABASE
name SET TABLESPACE as that is not in 8.3.

> new tablespace using new vol, move the smallest db for which I have
You cannot move a db as a unit, you will need to move the individual
tables/indexes in the db.

> backup, create new test table and examine new/existing table= s if they
> have moved by selecting tablespace from pg_tables... right?<= br>
Assuming you either specify the new tablespace on table CREATE or have
set default_tablespace to the new tablespace.

>
>
> http://www.postgresonline.com/journal/archives/123-Managing-disk-space-usin= g-table-spaces.html
> Managing disk space using table spaces - Postgres OnLine Journal - > Postgres OnLine Journal Magazine Jul 2017 - Dec 2017
> <http://www.postgresonline.com/jour= nal/archives/123-Managing-disk-space-using-table-spaces.html>
> Below are steps to creating one. First create a folder on an available=
> disk in your filesystem using an filesystem server administrative logi= n;
> Next give full rights to the postgres server account (the one the daem= on
> process runs under) or you can change the owner of the folder to the <= br> > postgres account (in linux you can use chown postgres and on windows <= br> > just use the administrative properties ...
> www.postgresonline.com >
>
>
> ----------------------------------------------------------------------= --
> *From:* Adrian Klaver <adrian.klaver@aklaver.com>
> *Sent:* Monday, May 13, 2019 2:47 PM
> *To:* Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-gener= al
> *Subject:* Re: does postgresql backup require additional space on disk=
> On 5/13/19 1:26 PM, Julie Nishimura wrote:
>> Adrian, thanks for your reply. Couple of clarifications/questions:=
>> 1) we are on 8.3 for this server
>
> 8.3 does not have ALTER DATABASE name SET TABLESPACE :
>
> https://www.postgresql.org/docs/8.3/sql-alterdatabase.html
>
> It does appear until 8.4.
>
>
>> 2) I was under impression, that "ALTER DATABASE name SET TABL= ESPACE
>> new_tablespace" won't move anything, and just utilize the new= _tablespace
>> for new tables/indexes. If we would want to move existing tables, = we
>> would need to move them one by one by
>
> No think of ALTER DATABASE name SET TABLESPACE  as a bulk operati= on of
> ALTER TABLE /mytableschema.mytable/ SET TABLESPACE /mynewtablespace/ > across all existing tables.  This assumes the all existing tables= live
> in the  current default tablespace. It is moot in your case as 8.= 3 is
> not capable of doing this.
>
>> ALTER TABLE /mytableschema.mytable/ SET TABLESPACE /mynewtablespac= e/
>> /
>> /
>
> The above is your option in 8.3.
>
>> 3) I thought if I want to have any newly created dbs go to the new= vol,
>> I need to alter template.
>
> It is not required you can spec the tablespace in the CREATE DATABASE<= br> > command:
>
> https://www.postgresql.org/docs/8.3/sql-createdatabase.html
>
> Though you can move them to make the tablespace the default. See above= link.
>
>
>> 4) I was also thinking about changing parameters in config file to= point
>> to the newly volume and reload postgresql.conf
>>
>> default_tablespace
>>
>> temp_tablespaces
>
> You could that. If you do it, moving the template tables would be redu= ndant.
>
>>
>>
>> Am I wrong here?
>>
>>
>> Thanks,
>>
>> Julie
>>
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com


--
Adrian Klaver
adrian.klaver@aklaver.com
--_000_BYAPR08MB50146EEF3401259093DA929BAC0F0BYAPR08MB5014namp_--