Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDrRJ-0004Y4-81 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Apr 2019 14:09:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDrRH-0003ar-OM for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Apr 2019 14:09:27 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDrRH-0003ak-9D for pgsql-hackers@lists.postgresql.org; Tue, 09 Apr 2019 14:09:27 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDrRD-0004Vv-H8 for pgsql-hackers@postgresql.org; Tue, 09 Apr 2019 14:09:26 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 2692F21C3ECF; Tue, 9 Apr 2019 17:09:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 5488F21C3E6F; Tue, 9 Apr 2019 17:09:21 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1554818961; bh=Qh3u1iwb7LIlLfF7BKPws8imByWsfq++/qqzOCFou2w=; h=Subject:To:References:From:Date:In-Reply-To; b=GwQhOxf0GKN2ZI7t5Q6Tt3QOgL0dS7d1ezJPdDKdtYl0z3yGWHr4YFyfNG7FbKbDw JKVqJzWKtNio0oNO60HYKVZ8WxNGZGdUXLbCijZekgoUua8vwvgfm83/JuKqCAUfLh WBQCHByHOyutKvPw6FC8+FeQAcJ2eq/k9ArScU2Y= Subject: Re: Zedstore - compressed in-core columnar storage To: Ashwin Agrawal , PostgreSQL mailing lists References: From: Konstantin Knizhnik Message-ID: Date: Tue, 9 Apr 2019 17:09:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------D6CCD1DCC011ADA75F1050A8" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------D6CCD1DCC011ADA75F1050A8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, On 09.04.2019 3:27, Ashwin Agrawal wrote: > Heikki and I have been hacking recently for few weeks to implement > in-core columnar storage for PostgreSQL. Here's the design and initial > implementation of Zedstore, compressed in-core columnar storage (table > access method). Attaching the patch and link to github branch [1] to > follow along. Thank you for publishing this patch. IMHO Postgres is really missing normal support of columnar store and table access method API is the best way of integrating it. I wanted to compare memory footprint and performance of zedstore with standard Postgres heap and my VOPS extension. As test data I used TPC-H benchmark (actually only one lineitem table generated with tpch-dbgen utility with scale factor 10 (~8Gb database). I attached script which I have use to populate data (you have to to download, build and run tpch-dbgen yourself, also you can comment code related with VOPS). Unfortunately I failed to load data in zedstore: postgres=# insert into zedstore_lineitem_projection (select l_shipdate,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag::"char",l_linestatus::"char" from lineitem); psql: ERROR:  compression failed. what now? Time: 237804.775 ms (03:57.805) Then I try to check if there is something in zedstore_lineitem_projection table: postgres=# select count(*) from zedstore_lineitem_projection; psql: WARNING:  terminating connection because of crash of another server process DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. HINT:  In a moment you should be able to reconnect to the database and repeat your command. psql: server closed the connection unexpectedly     This probably means the server terminated abnormally     before or while processing the request. The connection to the server was lost. Attempting reset: Failed. Time: 145710.828 ms (02:25.711) Backend consumes 16GB of RAM and 16Gb of swap and was killed by OOM killer (undo log?) Subsequent attempt to run the same command is failed with the following error: postgres=# select count(*) from zedstore_lineitem_projection; psql: ERROR:  unexpected level encountered when descending tree So the only thing I can do at this moment is report size of tables on the disk: postgres=# select pg_relation_size('lineitem');  pg_relation_size ------------------       10455441408 (1 row) postgres=# select pg_relation_size('lineitem_projection');  pg_relation_size ------------------        3129974784 (1 row) postgres=# select pg_relation_size('vops_lineitem_projection');  pg_relation_size ------------------        1535647744 (1 row) postgres=# select pg_relation_size('zedstore_lineitem_projection');  pg_relation_size ------------------        2303688704 (1 row) But I do not know how much data was actually loaded in zedstore table... Actually the main question is why this table is not empty if INSERT statement was failed? Please let me know if I can somehow help you to reproduce and investigate the problem. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------D6CCD1DCC011ADA75F1050A8 Content-Type: application/sql; name="vstore_bench.sql" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="vstore_bench.sql" Y3JlYXRlIGV4dGVuc2lvbiB2b3BzOwoKY3JlYXRlIHRhYmxlIGxpbmVpdGVtKAogICBsX29y ZGVya2V5IGludGVnZXIsCiAgIGxfcGFydGtleSBpbnRlZ2VyLAogICBsX3N1cHBrZXkgaW50 ZWdlciwKICAgbF9saW5lbnVtYmVyIGludGVnZXIsCiAgIGxfcXVhbnRpdHkgcmVhbCwKICAg bF9leHRlbmRlZHByaWNlIHJlYWwsCiAgIGxfZGlzY291bnQgcmVhbCwKICAgbF90YXggcmVh bCwKICAgbF9yZXR1cm5mbGFnICJjaGFyIiwKICAgbF9saW5lc3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