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 1hQztd-0007cM-0L for pgsql-general@arkaria.postgresql.org; Wed, 15 May 2019 19:49:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hQzsd-0000Qz-LC for pgsql-general@arkaria.postgresql.org; Wed, 15 May 2019 19:47:59 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQzsb-0000QU-KS for pgsql-general@lists.postgresql.org; Wed, 15 May 2019 19:47:59 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQzsX-0000Nz-1q for pgsql-general@lists.postgresql.org; Wed, 15 May 2019 19:47:56 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 53ABA207E1; Wed, 15 May 2019 15:47:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 15 May 2019 15:47:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=I SvC2HPpnEWml+o4H6VZPRYWGvuP441ch2D/vbhYvjk=; b=nds6t2VXd1cf+dTri sVqOzAuPsDSKd8n23rYE6ITsj82Y4RF34mVv8QdRJOgdtDNM9kX6zoHreKh35q7u ATZuCvEgXs1Ey6zJYVCCjo2fRPkLSuHEJI1dPp2K3DTTIRZgkiTwQZl5wzDQw3Eb oikAU9K0sYj6LjZrk6L2CSpqwjY+ZhxkNXRHxbMTj+4ZzSL5/UM+9UkU1y8HuV+c yAV82I7JJGpvzCgUZCGQ8KYQdkMl/uN5+S0ETHLq0ng3fZmgl4vFKGurhvZ/43Jz zJHS4LMEBDi5Au91f/gZDHFL3N1I2nHlE1UI6dvXx5PpI/jhyjtQRG7pKWvoVS4O hA8QQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=ISvC2HPpnEWml+o4H6VZPRYWGvuP441ch2D/vbhYv jk=; b=Gj/5hfrkdbknTchR1gXpNdhttIZ5yzv1o5Yk0fLZgUwziuBJpvVxMVdTg umYOhhqgw0fOhrO8qJdy32IzFSFgUubGXdc+o7VyROYFHjWQ/mvz6qlVMolVQT1s jO8jcQUBgUy5NuXUhgdqpno9ZjDIUatjy3nXog9AUbaOTNJrEo7XDeoUGbZlvGBu h9ybfSCOcqmAaGneOmiQNPvjzsbmJtA5z+HndBJ3IoX9c+hLr0NZrU8l2drm01z4 76R7+e6vR5ax8yReIZo9kXMwPTtQUOq22xj1WCAR6wyiYMwoJjtbYXcmny/+9Acy fu8L1b6Ve+moe+KHS0scWQFQGesyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrleekgddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucfkphepjedurddvuddvrdduhedtrddvtddvnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 0A87510323; Wed, 15 May 2019 15:47:48 -0400 (EDT) Subject: Re: default_tablespace in 8.3 postgresql To: Julie Nishimura , "pgsql-general@lists.postgresql.org" , pgsql-general References: From: Adrian Klaver Message-ID: Date: Wed, 15 May 2019 12:47:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 = '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 = '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