Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRZao-00DZBT-3N for pgsql-general@arkaria.postgresql.org; Tue, 17 Jun 2025 16:55:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uRZal-00BQxQ-1N for pgsql-general@arkaria.postgresql.org; Tue, 17 Jun 2025 16:55:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRZak-00BQuI-0P for pgsql-general@lists.postgresql.org; Tue, 17 Jun 2025 16:55:23 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uRZag-002a08-2e for pgsql-general@postgresql.org; Tue, 17 Jun 2025 16:55:22 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 3165A138046E; Tue, 17 Jun 2025 12:55:16 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Tue, 17 Jun 2025 12:55:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1750179316; x=1750265716; bh=tFKoIElHNKtkRsvOWsMzMhTj94RMwAov7XjzJo5TvSU=; b= OphQIBpTu3jxVS2nC57OZ/jeXyFB4JSwfDn0WnZBvIZ4TAlzuSD2HfX93O85IAt/ 2LmF1LgT+nO/jIvyG0k5Qw/FGjiqKVlMH6VKowxSlO9Hd/xGRkfoOT0WDsqOWeGb rHGdeSse9Cq7NnVa9jQebtfdfzluMrP8xRVuxkcXmFplHjJVFd+lEvWGc6qaaNs6 /cus1TCXAIf09tVfHOXYjaGa0PfhbXOWZ43A8OCgEVKmW+dODPmXg2UVozpqlF1l 5J1i1PsFIpDyDQZ5Xem13zGgYkKdBGss99VAdLkaxR2CBn2WkaQPuXt8IMPqh3SN WkcD/zvg0zVKl5pVZUNz6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1750179316; x=1750265716; bh=t FKoIElHNKtkRsvOWsMzMhTj94RMwAov7XjzJo5TvSU=; b=SYW01ZQkRUBr+fQ4P yqD619G4GdgqeR5fLtHfKXex2yko+OBTsxW/2Va76nagc6ZBw0PnE5Bg5w+00SoI BrT6h7MGgp5dp5tQR8M0c7T8guzckM6i+XieQU3VVZtqWYtXh5wAA7cGmp6bhbEw sjHfKy/CmnglLo7GXk3VX0ipoHlCEI5ioQ3ztxBd295CQmJP8lsAurJOKqJtIm+4 Yi4Go/prheZ+bw0ijankj2KUrcLOb5pmWIHPBcY5ZOWXD0dII30TR1F/CKfCy0VV SdegkXaEbz2auCGeynDvK3fHUSoKYImSbdvOeavETgvdh233H2RUeoh3zL5v95B+ 0VxvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdejudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecu hfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrg hklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepffelgeeifefgveduhedthfek uedtffejveegffegjeevtdehgfduieetfeehjeehnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgr vhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepghhoiigurghlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdq ghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Jun 2025 12:55:15 -0400 (EDT) Message-ID: <603f35e6-32b2-4044-bbfb-5e70bba5164b@aklaver.com> Date: Tue, 17 Jun 2025 09:55:14 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Changing locale of an existing database To: Marcin Gozdalik , pgsql-general@postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/17/25 09:20, Marcin Gozdalik wrote: > Hi > > I am using PostgreSQL 17 and would like to take advantage of performance > and stability across OS updates of builtin C.UTF-8 locale. > I have a cluster with a DB created with en_US.UTF-8 libc locale. I would > like to migrate the DB to C.UTF-8. Ideally there'd be an "ALTER DATABASE > ... SET LOCALE ..." command that would take care of it but it seems it > doesn't exist. I was thinking that I could change the collation of all > TEXT/CHAR/VARCHAR columns in all the tables to pg_c_utf8, REINDEX all > those columns and change the default locale in the pg_database table. > > Is it a sensible plan? Am I missing some steps? I can't find any > reference to anybody doing that before or discouraging it. How big a database are we talking about? To me it would seem easier to create a new database with new locale and do either a pg_dump/pg_restore or logical replication to the new instance. Of course this may depend on the answer to the question above. > > Thanks, > Marcin > > -- > Marcin Gozdalik -- Adrian Klaver adrian.klaver@aklaver.com