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 1qMXMW-002dcg-Se for pgsql-admin@arkaria.postgresql.org; Thu, 20 Jul 2023 17:22:48 +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 1qMXMV-00CyDp-C8 for pgsql-admin@arkaria.postgresql.org; Thu, 20 Jul 2023 17:22:47 +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 1qMXMU-00CyCo-T6 for pgsql-admin@lists.postgresql.org; Thu, 20 Jul 2023 17:22:47 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qMXMP-000Xb4-Ot for pgsql-admin@lists.postgresql.org; Thu, 20 Jul 2023 17:22:45 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-579ef51428eso11247377b3.2 for ; Thu, 20 Jul 2023 10:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689873761; x=1690478561; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Nw5E6HHVyEcjMqEmnPRgjbyRfAr3n0V6Jeu84Fcg4cE=; b=cZpeR8WJBVTYrIwdfDFI6E3JAaAqaDwHrOe2VG4pyra+QMIi1nNMtEyPk3hXOwxBE3 /CEmZx8rNplHj0gcwFFi6qZN3N574wwWuW52KQOTUM1ZPQdKIS8lXy/oGyR0mvYIKol0 KfumomDmvP9yKG8VnVvYZ75qdsDlI48Em2e9B1NO9EZO73YEfMb7gC3S2aytmt42EM70 y7h/Km6QdH3QXHWeeWGcvas2R3lxQBLMa9lKK39HRU7RLgUoPNYJmE0XYK3sbQnNMrhr zaT/3AtyOmlEDBflksu/CwfqX8YDnNdD5S6/5wfPNL+AKEaJmBWuWIeKXXeosWsc4ezH W/JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689873761; x=1690478561; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Nw5E6HHVyEcjMqEmnPRgjbyRfAr3n0V6Jeu84Fcg4cE=; b=JgUVpN8V9lIPebRHc9Ji07xG+F4KeUa/SXu2TiSfPH4vYE7PBsFKrLDoXMFiK7tckn iinolGcZJ0+ZLx/XbZlp+6ZDmvfqBoEBsm2yf+QfMUI8u6BnVqfAyXzFiP3DBm4KO7bz T76FHgFlS+Rqk3EvGfS5/Ji3NwhqlND7+yHFzD7kwM0RW/mGPsSG5twQCjJgZYLKVZ5T V6rD2AO9ieKcQucAF5jLjP0lx86kR86egTblL6/lybuHf2pPMZhhP4QTxs2PugMP7wDO pXoXD60A8jxb5W1+TTMEdn2jDjO2+ohYxL7WMjZ/I6lNOUbRBfqwFeQXUtzTEGAq/sxg JiBQ== X-Gm-Message-State: ABy/qLbGukPbuWgADyFxAHrHij6iSJZ1frxFMOOoDCKEdwb4qMuykfKA D2NbChl1LeMYj5O7azzHOxlhVcfU3eA= X-Google-Smtp-Source: APBJJlGjtebjsXv76V12wuMFnbrVDs2CNZl66yMECkFTc17L/iZP7DdQY3rWYlQ1g4fDH0S5bkGrzg== X-Received: by 2002:a81:6b03:0:b0:56d:292d:a225 with SMTP id g3-20020a816b03000000b0056d292da225mr11937651ywc.43.1689873760525; Thu, 20 Jul 2023 10:22:40 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:64d0:3aec:6103:5398? ([2600:1700:bd2c:b810:64d0:3aec:6103:5398]) by smtp.googlemail.com with ESMTPSA id w189-20020a8162c6000000b00582fae92aa7sm326110ywb.93.2023.07.20.10.22.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jul 2023 10:22:40 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------0AiNanArdWiqkZghnzFFL3DW" Message-ID: <78789644-f55a-51eb-8507-58415064414d@gmail.com> Date: Thu, 20 Jul 2023 12:22:39 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Upgrade from PG12 to PG Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: <3901e0da-819b-5b6d-bb57-c29f6d384725@gmail.com> <1cb1652e-286a-077e-950d-516970ecf499@gmail.com> From: Ron In-Reply-To: <1cb1652e-286a-077e-950d-516970ecf499@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------0AiNanArdWiqkZghnzFFL3DW Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Jeff, It does a "--schema-only" dump.  The /gianter/ the schema, the longer that "pg_dump --schema-only" takes. Note also that there's a known issue with pg_upgrade and /millions/ of Large Objects (not bytea or text, but lo_* columns). On 7/20/23 12:05, Jef Mortelle wrote: > running /usr/lib/postgresql15/bin/pg_upgrade -v -p 5431 -P 5432 -k > > gives you in the output : > > ... > "/usr/lib/postgresql15/bin/pg_dump" --host /pg/PG15 --port 5431 --username > postgres --schema-only --quote-all-identifiers --binary-upgrade > --format=custom --verbose > --file="/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/dump/pg_upgrade_dump_16385.custom" > 'dbname=dbname' >> > "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/log/pg_upgrade_dump_16385.log" > 2>&1 > ... > > > so, yes pg_ugrade start a pg_dump session, > > > even a pg_restore at the end, runs about 7 hours > > "/usr/lib/postgresql15/bin/pg_restore" --host /pg/PG15 --port 5432 > --username postgres --create --exit-on-error --verbose --dbname template1 > "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/dump/pg_upgrade_dump_16385.custom" > >> > "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/log/pg_upgrade_dump_16385.log" > 2>&1 > > with a lot of lines in the logfiles  like:  pg_restore: executing BLOB > 11108809 > > > Server is a VM server, my VM has 64GB SuseSLES  attached to a SAN with SSD > disk (Hp3Par) > > 2)vacuumlo > > lovacum -n =>  I have vacuumlo, running this: > > vacuumlo  dbname  -v > > postgres@dbfluxd02:/pg/data> vacuumlo  dflux -v > Connected to database "dflux" > Checking message_oid in fluxnaf.flux_message_content > Checking payload_oid in fluxnaf.bridge_payload_content > Successfully removed 0 large objects from database "dflux". > > and again same issues > > > > On 20/07/2023 16:51, Scott Ribe wrote: >>> On Jul 20, 2023, at 7:46 AM, Jef Mortelle wrote: >>> >>> So: not possible to have very little downtime if you have a database >>> with al lot rows containing text  as datatype, as pg_upgrade needs 12hr >>> for 24 milj rows in pg_largeobject. >> We need to get terminology straight, as at the moment your posts are very >> confusing. In PostgreSQL large objects and text are not the same. Text is >> basically varchar without a specified length limit. Large object is a >> blob (but not what SQL calls a BLOB)--it is kind of like a file stored >> outside the normal table mechanism, and provides facilities for partial >> reads, etc: https://www.postgresql.org/docs/15/largeobjects.html. There >> are a number of ways to wind up with references to large objects all >> deleted, but the orphaned large objects still in the database. >> >> First thing you should do: run lovacuum -n to find out if you have >> orphaned large objects. If so, start cleaning those up, then see how long >> pg_upgrade takes. >> >> Second, what's your hardware? I really don't see dump & restore of a 1TB >> database taking 6 hours. >> >>> Alsready tried to use --link and --jobs, but you cannot ommit the >>> "select  lo_unlink ...."   for every rows containing datatype text in >>> your database that the pg_* program creates in the export/dump file. >> Terminology again, or are you conflating two different issues? pg_upgrade >> --link does not create a dump file. > > -- Born in Arizona, moved to Babylonia. --------------0AiNanArdWiqkZghnzFFL3DW Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Jeff,

It does a "--schema-only" dump.  The gianter the schema, the longer that "pg_dump --schema-only" takes.

Note also that there's a known issue with pg_upgrade and millions of Large Objects (not bytea or text, but lo_* columns).

On 7/20/23 12:05, Jef Mortelle wrote:
running /usr/lib/postgresql15/bin/pg_upgrade -v -p 5431 -P 5432 -k

gives you in the output :

...
"/usr/lib/postgresql15/bin/pg_dump" --host /pg/PG15 --port 5431 --username postgres --schema-only --quote-all-identifiers --binary-upgrade --format=custom --verbose --file="/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/dump/pg_upgrade_dump_16385.custom" 'dbname=dbname' >> "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/log/pg_upgrade_dump_16385.log" 2>&1
...


so, yes pg_ugrade start a pg_dump session,


even a pg_restore at the end, runs about 7 hours

"/usr/lib/postgresql15/bin/pg_restore" --host /pg/PG15 --port 5432 --username postgres --create --exit-on-error --verbose --dbname template1 "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/dump/pg_upgrade_dump_16385.custom" >> "/pg/PG15/system/pg_upgrade_output.d/20230720T184333.610/log/pg_upgrade_dump_16385.log" 2>&1

with a lot of lines in the logfiles  like:  pg_restore: executing BLOB 11108809


Server is a VM server, my VM has 64GB SuseSLES  attached to a SAN with SSD disk (Hp3Par)

2)vacuumlo

lovacum -n =>  I have vacuumlo, running this:

vacuumlo  dbname  -v

postgres@dbfluxd02:/pg/data> vacuumlo  dflux -v
Connected to database "dflux"
Checking message_oid in fluxnaf.flux_message_content
Checking payload_oid in fluxnaf.bridge_payload_content
Successfully removed 0 large objects from database "dflux".

and again same issues



On 20/07/2023 16:51, Scott Ribe wrote:
On Jul 20, 2023, at 7:46 AM, Jef Mortelle <jefmortelle@gmail.com> wrote:

So: not possible to have very little downtime if you have a database with al lot rows containing text  as datatype, as pg_upgrade needs 12hr for 24 milj rows in pg_largeobject.
We need to get terminology straight, as at the moment your posts are very confusing. In PostgreSQL large objects and text are not the same. Text is basically varchar without a specified length limit. Large object is a blob (but not what SQL calls a BLOB)--it is kind of like a file stored outside the normal table mechanism, and provides facilities for partial reads, etc: https://www.postgresql.org/docs/15/largeobjects.html. There are a number of ways to wind up with references to large objects all deleted, but the orphaned large objects still in the database.

First thing you should do: run lovacuum -n to find out if you have orphaned large objects. If so, start cleaning those up, then see how long pg_upgrade takes.

Second, what's your hardware? I really don't see dump & restore of a 1TB database taking 6 hours.

Alsready tried to use --link and --jobs, but you cannot ommit the "select  lo_unlink ...."   for every rows containing datatype text in your database that the pg_* program creates in the export/dump file.
Terminology again, or are you conflating two different issues? pg_upgrade --link does not create a dump file.



--
Born in Arizona, moved to Babylonia.
--------------0AiNanArdWiqkZghnzFFL3DW--