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 1sdw92-002PKM-WB for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2024 18:21:21 +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 1sdw90-005Wtd-Gl for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2024 18:21:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdw8z-005WtV-Dd for pgsql-general@lists.postgresql.org; Tue, 13 Aug 2024 18:21:18 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdw8s-004a3o-CA for pgsql-general@postgresql.org; Tue, 13 Aug 2024 18:21:16 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id B582420002; Tue, 13 Aug 2024 18:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1723573267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vNQ9uF0L6zn7fwqCLrb8XPDQUnXjf1WAmORHnRcARHI=; b=kPWkA5uo/fO8Yxb01jiPaTdJL9K1zqXWLAnUTYt3khjPd+EJk5GVJpf4oDTiOPBzSQRXkE vN9le+uxnGNUPpKxhhAad7UiKQL0+AORRDRqIaSYpiA12FEf4sxGjEz2RlOqFyejIJOFoy sMWFCj3huf26184I3kvHvQ2ndW767YpdF1wz/s8MUitvu5vLvOSI5Im9fk24k8zAo/N7H2 SASQrJ86nst8zUdzpCNjI6co6WJL1BsYeBVYXPTE9696/Nx5VH+JURt/aBtJwNCbVKeI8B YCH43Q6fPZHU83to5/YEMd8gVPHMhPH9ILAQpta1Czqc5fhbG08C1bR9dPRsXA== Message-ID: <37ed3aef-58e6-417b-8015-cdf030a6df4b@vondra.me> Date: Tue, 13 Aug 2024 20:21:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PG Dump on 11 - Restore on 16 - is possible? To: Durumdara , Postgres General References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/13/24 11:47, Durumdara wrote: > Hello! > > We have to upgrade our server. The PG upgrade is impossible because of > too much data. I'm not sure I understand. What exactly is the problem with the amount of data? How much data are you dealing with, and is the problem in the amount it takes to copy the data, or do you have limited amount of disk space, or what is the issue? I'd say pg_upgrade (in link mode) is probably orders of magnitude faster for upgrading large clusters - probably less than a minute even for huge clusters (multiple TB of data). And it doesn't need more disk space, it does not copy most of the data. Typically, you create a replica on the new system (or clone the fs volume in some way), and then switch over and do the pg_upgrade. pg_dump is pretty expensive - it exports and imports the database, has to rebuild indexes, ... I'd be surprised if this wasn't more laborious and time consuming than the pg_upgrade way. > So we will create a new server with PG 16, and we have to migrate the > databases one by one (from a PG 11 server). > > Is it possible? > > Does PG16 read PG11 dumps and restore them correctly on the PG16 server? > Yes. The docs actually say this: Because pg_dump is used to transfer data to newer versions of PostgreSQL, the output of pg_dump can be expected to load into PostgreSQL server versions newer than pg_dump's version. > Or is it unsupported now? > It's true PG11 is EOL already, but AFAIK the dump/restore should work, we try to support even unsupported versions - I don't recall if the policy is ~10 years, but the docs say: pg_dump can also dump from PostgreSQL servers older than its own version. (Currently, servers back to version 9.2 are supported.) I'd probably use pg_dump from the target version (PG16), but it should not matter. regards -- Tomas Vondra