Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZsBIm-0005ok-Fr for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Oct 2015 15:09:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZsBIm-0006gY-0I for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Oct 2015 15:09:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZrywL-0002aG-Q8 for pgsql-bugs@postgresql.org; Fri, 30 Oct 2015 01:57:13 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZrywE-0006AQ-Na for pgsql-bugs@postgresql.org; Fri, 30 Oct 2015 01:57:13 +0000 MIME-Version: 1.0 Subject: BUG #13749: PostgreSQL cann't compress random data? To: pgsql-bugs@postgresql.org From: digoal@126.com Date: Fri, 30 Oct 2015 01:56:46 +0000 Message-ID: <20151030015646.3021.82858@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13749 Logged by: digoal Email address: digoal@126.com PostgreSQL version: 9.4.5 Operating system: CentOS 6.x x64 Description: postgres=# create table test_plain(c text); CREATE TABLE postgres=# alter table test_plain alter column c set storage external; ALTER TABLE postgres=# create table test_compress(c text); CREATE TABLE postgres=# alter table test_compress alter column c set storage extended; ALTER TABLE postgres=# insert into test_plain select repeat(md5(random()::text),10000) from generate_series(1,1000); INSERT 0 1000 postgres=# insert into test_compress select repeat(md5(random()::text),10000) from generate_series(1,1000); INSERT 0 1000 postgres=# select pg_size_pretty(pg_total_relation_size('test_compress')); pg_size_pretty ---------------- 4168 kB (1 row) postgres=# select pg_size_pretty(pg_total_relation_size('test_plain')); pg_size_pretty ---------------- 317 MB (1 row) the above case use repeat generate a big data. but when i use the other case, pgsql cann't compress the data, is the compress algorithm bug? postgres=# truncate test_compress ; TRUNCATE TABLE postgres=# truncate test_plain ; TRUNCATE TABLE postgres=# do language plpgsql $$ declare begin for i in 1..100 loop insert into test_compress select string_agg(md5(random()::text),' ') v from generate_series(1,10000); end loop; end; $$; DO postgres=# do language plpgsql $$ declare begin for i in 1..100 loop insert into test_plain select string_agg(md5(random()::text),' ') v from generate_series(1,10000); end loop; end; $$; DO postgres=# select pg_size_pretty(pg_total_relation_size('test_compress')); pg_size_pretty ---------------- 33 MB (1 row) postgres=# select pg_size_pretty(pg_total_relation_size('test_plain')); pg_size_pretty ---------------- 33 MB (1 row) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs