0

I am trying to update PostgreSQL 11.2 to PostgreSQL 14.0.

My PG 11 Data directory size is 1.1 GB and my PG 14 data directory is 41 MB before the upgrade.

I am now running my below upgrade command:

"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --link --check

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

*Clusters are compatible*

C:\pg_upgrade_log>"C:\Program Files\PostgreSQL\14.0\bin\pg_upgrade.exe" -U postgres --old-bindir "C:\Program Files\PostgreSQL\11.2\bin" --new-bindir "C:\Program Files\PostgreSQL\14.0\bin" --old-datadir "C:\pgData112" --new-datadir "C:\pgData140" -p 5432 -P 5433 --retain

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for user-defined encoding conversions              ok
Checking for user-defined postfix operators                 ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting oldest XID for new cluster                          ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok

WARNING:  user-defined tablespace locations should not be inside the data directory, e.g. C:/pgData112/ad/ADG/ADG_ADG7x1_TS
Checking for extension updates                              ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    C:/Program Files/PostgreSQL/14.0/bin/vacuumdb -U postgres --all --analyze-in-stages

Could not create a script to delete the old cluster's data files
because user-defined tablespaces or the new cluster's data directory
exist in the old cluster directory.  The old cluster's contents must
be deleted manually.

C:\pg_upgrade_log>

enter image description here

All the steps are stated as OK and the Upgrade Completed message is displayed.

The same is happening with --link option as well.

Now, why the original PG 11.2 data size does not matched with PG 14 data size? is there any issue happened while upgrade? I dont see any error message also.

Am I doing it the right way?

EDIT:

In our application, say, when we create a record, it creates a custom named directory under PG data folder, and inside some FILE type files are placed. So far, that directory holds about 550MB of data in PG 11.2's C:\pgdata112.

After PG upgrade to PG 14, that directory was not present in PG 14 data folder, C:\pgdata140. But all other remaining directories holds the same size.

Only that custom made directory's files seeems to be missing and so the size difference is seen.

enter image description here

6
  • 1
    The warning about the tablespaces might have something to do with that, but I am not sure. Commented Dec 7, 2022 at 11:24
  • Did you run a VACUUM FULL on the old cluster? The files might contain much less data than their actual size on disk. Commented Dec 7, 2022 at 13:25
  • @SebDieBln I run VACUUM with --analyze-in-stages, result is same. Commented Dec 7, 2022 at 14:29
  • @Bala --analyze-in-stages is not what frees up unused space in the table files. It merely calculates statistics for the optimizer. Commented Dec 7, 2022 at 14:32
  • human readable log file and WAL files are not copied to the new server, and the tablespaces it warned you about are also still hosted in the old server's directory, not in the new servers's. Commented Dec 7, 2022 at 16:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.