pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thorsten Schöning <tschoening@am-soft.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Increased size of database dump even though LESS consumed storage
Date: Tue, 09 Feb 2021 10:05:05 -0500
Message-ID: <861906.1612883105@sss.pgh.pa.us> (raw)
In-Reply-To: <984279108.20210209105618@am-soft.de>
References: <984279108.20210209105618@am-soft.de>

=?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?=<tschoening@am-soft.de> writes:
> for various reasons I've migrated my database schema from 4 tables
> with some additional indexes to keep integrity and stuff to 1 table
> only. That made some of the former used indexes obsolete and resulted
> in overall less consumed storage:
> The old schema consumed ~42 GiB, while the new is ~16 GiB without the
> formerly available indexes and ~25 GiB with the same logical indexes.
> Though, a created dump of the new schema has increased from ~5,52 GiB
> to 6,38 GiB. Of course I'm using the same settings to create both
> dumps:
>> pg_dump.exe "--username=%USERNAME%" "--encoding=UTF-8" "--compress=9" "--format=c" "--dbname=%DB_NAME%" > "%DMP_PATH%"
> My expectation was that the dump would be smaller as well, because the
> data itself is the same, while lots of duplicate IDs, obsolete indexes
> etc. in not available tables anymore have been removed.

Removing indexes won't in itself make any noticeable difference in the
size of pg_dump output, since an index is just represented by a CREATE
INDEX (or equivalent) command.

My guess is that the rearrangement somehow made the table data less
amenable to compression.  gzip depends on finding similar substrings
within a fairly narrow window (a few KB), so at least in principle,
just changing the order of rows could make a difference.  I'd sort
of expect compression opportunity losses to more or less balance out
with opportunity gains over such a large data volume, but maybe you
were unlucky.  Or perhaps the move into a single table was done in
such a way that it actually decreased locality-of-reference, eg maybe
similar rows were grouped before and now they're not.

			regards, tom lane





view thread (10+ messages)  latest in thread

Message-ID: <861906.1612883105@sss.pgh.pa.us>
Permalink:  ../861906.1612883105@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/861906.1612883105@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tschoening@am-soft.de
  Subject: Re: Increased size of database dump even though LESS consumed storage
  In-Reply-To: <861906.1612883105@sss.pgh.pa.us>
  References: <984279108.20210209105618@am-soft.de> <861906.1612883105@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox