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 1hR0Dv-0000rB-In for pgsql-general@arkaria.postgresql.org; Wed, 15 May 2019 20:10:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hR05f-0007SB-V8 for pgsql-general@arkaria.postgresql.org; Wed, 15 May 2019 20:01:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hR05f-0007Rc-3r for pgsql-general@lists.postgresql.org; Wed, 15 May 2019 20:01:27 +0000 Received: from mail-oln040092011084.outbound.protection.outlook.com ([40.92.11.84] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hR05b-0000Y8-4O for pgsql-general@lists.postgresql.org; Wed, 15 May 2019 20:01:25 +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=+Wpt53NRRm2F7yGActFgXcw6oJFibfctGaAWMJl74Y8=; b=cvUNQFK8yzbOsE65VIIM5DlXwggs7TjB5ACKZNDPJk8VSK3LkQwX40EGYT80jTIHnJ1N3PoBdVpjTHwqi45RzAEzGrbjDVSLH3XonpVwLgMpJGo0dQU7w6w4np+IjgOKgr3wmpePbZGqdgKG/LmPTMwxOozgwozwp200xhMfzG8vxbxQW6NhiQ0veAIFdE9qr47mLbc9qU53uBt886cwX6AV5pFQeauaxcWevF9lUAXLeRfNtLnMgL7MdbRMSSwQr+VKTZjOTAisngBXAyk31lPXhPbif2EB5uSUOoA9Q0VD51cA7BpXKKGMH0pQTS7TUYcFrZQ/33aSS36vheOfPQ== Received: from BN3NAM04FT061.eop-NAM04.prod.protection.outlook.com (10.152.92.56) by BN3NAM04HT180.eop-NAM04.prod.protection.outlook.com (10.152.92.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.15; Wed, 15 May 2019 20:01:21 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com (10.152.92.57) by BN3NAM04FT061.mail.protection.outlook.com (10.152.92.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.15 via Frontend Transport; Wed, 15 May 2019 20:01:21 +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.1900.010; Wed, 15 May 2019 20:01:20 +0000 From: Julie Nishimura To: Adrian Klaver , "pgsql-general@lists.postgresql.org" , pgsql-general Subject: Re: default_tablespace in 8.3 postgresql Thread-Topic: default_tablespace in 8.3 postgresql Thread-Index: AQHVC1LRf5EjIXLPnkq3LH4ZEkrRWqZsl38AgAAAObc= Date: Wed, 15 May 2019 20:01:20 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:B85B8F50A3CA04E895F68E62A0B54E019586605F9117D9776A9B2514B8B1C485;UpperCasedChecksum:1909E1EACA83BC942947517901E2CD633C8DD388D9E3534CA5514434245ED8F6;SizeAsReceived:6908;Count:43 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Gf/6vUPwTV27pyzo6F5IC62WV45C+SyA] 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:BN3NAM04HT180; x-ms-traffictypediagnostic: BN3NAM04HT180: x-ms-exchange-purlcount: 1 x-microsoft-antispam-message-info: O97VH99K8CXUx5cH4rBA5opLz7WPvWMEKC0s48AYDYgyefRV62xxav07ZjThZDXuyp92Jxg3tR7RLJ/MO69grRJt9Slzw5YQIzkg1AApQzsQ5u/phZDycwXDsncw7fSttslIxRCOugUUV8VWYhdAvihWpuxqkV+/wcygBGmqYYBDjTP4+mAfadN3zc1dVZy/ Content-Type: multipart/alternative; boundary="_000_BYAPR08MB50141ABB3D3816BDA9D0F583AC090BYAPR08MB5014namp_" 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: 66d7dcbd-b212-428a-0c74-08d6d9701960 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 May 2019 20:01:20.4553 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT180 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_BYAPR08MB50141ABB3D3816BDA9D0F583AC090BYAPR08MB5014namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Adrian, thanks for your reply. This is very interesting behavior... Those databases have been created long time ago, only some tables in them w= ere created today. So, make it more clear: lets say we have 5 user databases, 5 tables in each= db, + template0, template1, . I have modified 3 user databases and templat= e1 to use new tablespace. However, since I have modified template1 (and mos= t likely, those databases were copied from it in the past), it changed defa= ult_parameter for them as well. Interesting... Thanks ________________________________ From: Adrian Klaver Sent: Wednesday, May 15, 2019 12:47 PM To: Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-general Subject: Re: default_tablespace in 8.3 postgresql On 5/15/19 12:39 PM, Julie Nishimura wrote: > Hello, I have created new tablespace on a new drive yesterday and > modified some of existing databases to use this tablespace as default, > like this: > ALTER DATABASE xxx > SET default_tablespace =3D 'vol4'; > > So, this command did not physically move any existing tables/indices on > the database xxx, but all new objects are currently being created on > this tablespace (this was expected). > > Please note, I also altered "template1" database to use new volume, to > ensure all new databases will be created there by default. > > ALTER DATABASE template1 > SET default_tablespace =3D 'vol4'; > > However, I have not yet modified postgresql.conf, and our settings for > default_tablespace and temp_tablespaces still set to use "vol3", because > I was planning to leave some of databases out of vol4 (newer > tablespace), since I did NOT altered their default_tablespace, and it > was previously set to vol3. > > Today, checking which tables were created where, I noticed, that all new > tables, including tables from those databases which I did not alter to > use new volume as default_tablespace, have been created on new volume 4. > If I select from pg_database, I can see all my user databases have > default_tablespace as vol4 (newer tablespace), even though I did not > modify it. So, my question is, could altering "template1" database > change default tablespace for all existing databases on a server??? https://www.postgresql.org/docs/8.3/manage-ag-tablespaces.html "If a database is created without specifying a tablespace for it, it uses the same tablespace as the template database it is copied from." > > PS. I could not make a mistake altering all, since I scripted my > commands before, eliminating some of databases, and I do not see it in > my script. Any thoughts? > > Thank you > -- Adrian Klaver adrian.klaver@aklaver.com --_000_BYAPR08MB50141ABB3D3816BDA9D0F583AC090BYAPR08MB5014namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Adrian, thanks for your reply.
This is very interesting behavior...
Those databases have been created long time ago, only some tables in them w= ere created today.
So, make it more clear: lets say we have 5 user databases, 5 tables in each= db, + template0, template1, . I have modified 3 user databases and tem= plate1 to use new tablespace. However, since I have modified template1 (and= most likely, those databases were copied from it in the past), it changed default_parameter for them as well. Inter= esting...

Thanks




From: Adrian Klaver <a= drian.klaver@aklaver.com>
Sent: Wednesday, May 15, 2019 12:47 PM
To: Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-gener= al
Subject: Re: default_tablespace in 8.3 postgresql
 
On 5/15/19 12:39 PM, Julie Nishimura wrote:
> Hello, I have created new tablespace on a new drive yesterday and
> modified some of existing databases to use this tablespace as default,=
> like this:
> ALTER DATABASE xxx
> SET default_tablespace =3D 'vol4';
>
> So, this command did not physically move any existing tables/indices o= n
> the database xxx, but all new objects are currently being created on <= br> > this tablespace (this was expected).
>
> Please note, I also altered "template1" database to use new = volume, to
> ensure all new databases will be created there by default.
>
> ALTER DATABASE template1
> SET default_tablespace =3D 'vol4';
>
> However, I have not yet modified postgresql.conf, and our settings for=
> default_tablespace and temp_tablespaces still set to use "vol3&qu= ot;, because
> I was planning to leave some of databases out of vol4 (newer
> tablespace), since I did NOT altered their default_tablespace, and it =
> was previously set to vol3.
>
> Today, checking which tables were created where, I noticed, that all n= ew
> tables, including tables from those databases which I did not alter to=
> use new volume as default_tablespace, have been created on new volume = 4.
> If I select from pg_database, I can see all my user databases have > default_tablespace as vol4 (newer tablespace), even though I did not <= br> > modify it. So, my question is, could altering "template1" da= tabase
> change default tablespace for all existing databases on a server???
= https://www.postgresql.org/docs/8.3/manage-ag-tablespaces.html

"If a database is created without specifying a tablespace for it, it <= br> uses the same tablespace as the template database it is copied from."<= br>
>
> PS. I could not make a mistake altering all, since I scripted my
> commands before, eliminating some of databases, and I do not see it in=
> my script. Any thoughts?
>
> Thank you
>


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