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 1hFhy2-0002Et-Vb for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Apr 2019 16:26:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFhy1-0004PI-MB for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Apr 2019 16:26:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFhy1-0004Om-A7 for pgsql-hackers@lists.postgresql.org; Sun, 14 Apr 2019 16:26:53 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFhxy-0003JQ-3N for pgsql-hackers@postgresql.org; Sun, 14 Apr 2019 16:26:51 +0000 Received: by mail-wr1-x442.google.com with SMTP id r4so18536626wrq.8 for ; Sun, 14 Apr 2019 09:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ZRX0Je0xqcpr9ScO02yQj9RwIUPI0qnu5HzldQ2qmjM=; b=vjmtmKSLgmw9E4gXe0wLJeV45Oxu3NGBCDJJ1tsSaK5ACLwO1df4mVntoViFTeIcVD 3Rp9o/UYjivzLnfMMzlApgkL6BcBOpg+k3E4VTRztcc28rYVPz8FwhWT7kW97oL8EGs8 dgCk5CvJAWcnatmTROzwo7ExIqpMR0lQOTRgjCyZLEblRGCPPZOmGRiaQtadn2giLmhG 65SVWdnLkkNfloJrQrMU4fwYBBneWC+Ks7dZM+ztO6PAUCR8f81QWKcLEfGXdeSehTQC N0euWTtkbYnY4Hv6HV4ehtG+rFd/12iLUIXLLUOrZftlraJT4TSRr+UeEjzZFtfLRrDP fXTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=ZRX0Je0xqcpr9ScO02yQj9RwIUPI0qnu5HzldQ2qmjM=; b=IzDR8IqU2Zg20JG8/CplQwsOFkMc/39oDxYq7xxurhP/sgVtjsOfo4Bu76FF/7e30i ggn2/92Z/7tgH0QxeLdhAXBxn6QC35E94O+DpyXpZ+1Cxq7yyTWqoaX+uWSvpYbI3ARn mzMjSYqq0D8Ayts8LRj9/lzwai2w51m6dGFfs6vTENzvhBDU1O2AGCo2dhVmbuP2ZRMJ lq6dAd+UWdvdAMuMGR3+0o+wXfHrHDS5Hh6KMCxbAk0IF5CIKGkCg6E6m8NIIwj+LOD8 IcWMJrR/+U1IQlDysM9K7T/+P+yvt0ettgkSX0onx6Adod28QvhxbqrKLMf9W1cTOdvs Uipg== X-Gm-Message-State: APjAAAVZp0GkPh8lcKu0CBh10s3XAF5mXdccpfYeSZBExC9aQeZxdXkP 7hQZJiHu6quzHu1SoGzQ8WiF0w== X-Google-Smtp-Source: APXvYqxI2aihdXRcuvHfZ1APqHDaoG8I/7qWzZAWM0isGjhwNIeFPLh3dyTogHxIEOhAxqn7V34fUw== X-Received: by 2002:adf:f68d:: with SMTP id v13mr42894279wrp.6.1555259208077; Sun, 14 Apr 2019 09:26:48 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id o15sm44349033wrj.59.2019.04.14.09.26.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 09:26:47 -0700 (PDT) Date: Sun, 14 Apr 2019 18:26:45 +0200 From: Tomas Vondra To: Ashwin Agrawal Cc: Konstantin Knizhnik , Alvaro Herrera , PostgreSQL mailing lists Subject: Re: Zedstore - compressed in-core columnar storage Message-ID: <20190414162645.nrybpxeshtqf3r5s@development> References: <20190409155121.GA4320@alvherre.pgsql> <8391a140-55dd-7b78-42b7-c1cbfdba0df9@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Apr 09, 2019 at 02:03:09PM -0700, Ashwin Agrawal wrote: > On Tue, Apr 9, 2019 at 9:13 AM Konstantin Knizhnik > wrote: > > On 09.04.2019 18:51, Alvaro Herrera wrote: > > On 2019-Apr-09, Konstantin Knizhnik wrote: > > > >> 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 > > Yep. > > > >> and table access method API is the best way of integrating it. > > This is not surprising, considering that columnar store is precisely > the > > reason for starting the work on table AMs. > > > > We should certainly look into integrating some sort of columnar > storage > > in mainline.  Not sure which of zedstore or VOPS is the best > candidate, > > or maybe we'll have some other proposal.  My feeling is that having > more > > than one is not useful; if there are optimizations to one that can be > > borrowed from the other, let's do that instead of duplicating effort. > > > There are two different aspects: > 1. Store format. > 2. Vector execution. > > 1. VOPS is using mixed format, something similar with Apache parquet. > Tuples are stored vertically, but only inside one page. > It tries to minimize trade-offs between true horizontal and true > vertical storage: > first is most optimal for selecting all rows, while second - for > selecting small subset of rows. > To make this approach more efficient, it is better to use large page > size - default Postgres 8k pages is not enough. > >  From my point of view such format is better than pure vertical storage > which will be very inefficient if query access larger number of columns. > This problem can be somehow addressed by creating projections: grouping > several columns together. But it requires more space for storing > multiple projections. > > Right, storing all the columns in single page doens't give any savings on > IO. > Yeah, although you could save some I/O thanks to compression even in that case. > 2. Doesn't matter which format we choose, to take all advantages of > vertical representation we need to use vector operations. > And Postgres executor doesn't support them now. This is why VOPS is > using some hacks, which is definitely not good and not working in all > cases. > zedstore is not using such hacks and ... this is why it never can reach > VOPS performance. > > Vectorized execution is orthogonal to storage format. It can be even > applied to row store and performance gained. Similarly column store > without vectorized execution also gives performance gain better > compression rations and such benefits. Column store clubbed with > vecotorized execution makes it lot more performant agree. Zedstore > currently is focused to have AM piece in place, which fits the postgres > ecosystem and supports all the features heap does. Not sure it's quite orthogonal. Sure, you can apply it to rowstores too, but I'd say column stores are naturally better suited for it. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services