Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYEAr-0000DR-W2 for pgsql-admin@arkaria.postgresql.org; Thu, 20 Jul 2017 16:19:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dYEAr-0007vx-FY for pgsql-admin@arkaria.postgresql.org; Thu, 20 Jul 2017 16:19:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dYDrF-0001xo-1Y for pgsql-admin@postgresql.org; Thu, 20 Jul 2017 15:59:21 +0000 Received: from mx2.naumen.ru ([91.232.196.97]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dYDrB-00075n-Px for pgsql-admin@postgresql.org; Thu, 20 Jul 2017 15:59:19 +0000 Received: from mx2 (localhost.localdomain [127.0.0.1]) by mx2.naumen.ru (Postfix) with ESMTP id A1B056AC0DE8 for ; Thu, 20 Jul 2017 20:59:12 +0500 (YEKT) Received: from [192.168.158.31] (unknown [192.168.158.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vyanchenko@naumen.ru) by mx2.naumen.ru (Postfix) with ESMTPSA id 908DE6AC0CE2 for ; Thu, 20 Jul 2017 20:59:12 +0500 (YEKT) To: pgsql-admin@postgresql.org From: =?UTF-8?B?0K/QvdGH0LXQvdC60L4g0JLQu9Cw0LTQuNC80LjRgA==?= Subject: Strange size of pg_largeobject Message-ID: Date: Thu, 20 Jul 2017 20:59:12 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------5D108064646E980B76EF8D33" X-KLMS-Rule-ID: 3 X-KLMS-Message-Action: skipped X-KLMS-AntiSpam-Status: not scanned, whitelist X-KLMS-AntiPhishing: not scanned, whitelist X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.705, not scanned, whitelist List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------5D108064646E980B76EF8D33 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi all, I found that my pg_largeobject table is bigger than it should be: *Size:* mybase=# SELECT pg_size_pretty(pg_total_relation_size('pg_largeobject')); 18 GB mybase=# SELECT pg_size_pretty(pg_total_relation_size('pg_largeobject_loid_pn_index')); 162 MB *Rows count and large objects count:* mybase=# select count(*) from pg_largeobject 38406 mybase=# select count(*) from pg_largeobject where pageno = 0; 778 *The largest objects:* mybase=# select loid, count(pageno) from pg_largeobject group by loid order by count(pageno) limit 5 desc; loid | count -----------+------- 406485914 | 2188 167710689 | 1114 412765517 | 996 307045064 | 842 167714441 | 645 I write the largest lo to the file system and check their sizes: select lo_export(167710689, '/tmp/1'); select lo_export(406485914, '/tmp/2'); ls -lh /tmp/ -rw-r--r-- 1 postgres postgres *4,3M* июл 20 15:22 123 -rw-r--r-- 1 postgres postgres *2,2M* июл 20 15:23 1234 therefore, maximum size of my table should be 2.2*777 + 4.3 = 1713.7 mb (size2*[large objects count] + size1). Before I execute queries, that i mentioned above, I run vacuum full. But it does not effect. Now table bloating factor about 20%. Please, help me, if you have any suggestions about my problem. -- Best regards, Vladimir Yanchenko Tech support engineer Naumen --------------5D108064646E980B76EF8D33 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi all,

I found that my pg_largeobject table is bigger than it should be:

Size:
mybase=# SELECT pg_size_pretty(pg_total_relation_size('pg_largeobject'));
 18 GB
mybase=# SELECT pg_size_pretty(pg_total_relation_size('pg_largeobject_loid_pn_index'));
 162 MB

Rows count and large objects count:
mybase=# select count(*) from pg_largeobject
38406
mybase=# select count(*) from pg_largeobject where pageno = 0;
778

The largest objects:
mybase=# select loid, count(pageno) from pg_largeobject group by loid order by count(pageno) limit 5 desc;
   loid    | count
-----------+-------
 406485914 |  2188
 167710689 |  1114
 412765517 |   996
 307045064 |   842
 167714441 |   645

I write the largest lo to the file system and check their sizes:
select lo_export(167710689, '/tmp/1');
select lo_export(406485914, '/tmp/2');
ls -lh /tmp/
-rw-r--r-- 1 postgres postgres 4,3M июл 20 15:22 123
-rw-r--r-- 1 postgres postgres 2,2M июл 20 15:23 1234

therefore, maximum size of my table should be 2.2*777 + 4.3 = 1713.7 mb (size2*[large objects count] + size1).

Before I execute queries, that i mentioned above, I run vacuum full. But it does not effect. Now table bloating factor about 20%.


Please, help me, if you have any suggestions about my problem.
--
Best regards,
Vladimir Yanchenko
Tech support engineer
Naumen
--------------5D108064646E980B76EF8D33--