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 1gMiba-00016O-Dh for pgsql-general@arkaria.postgresql.org; Wed, 14 Nov 2018 00:00:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gMibX-0004Ib-Kt for pgsql-general@arkaria.postgresql.org; Wed, 14 Nov 2018 00:00:23 +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 1gMibX-0004IJ-Cy for pgsql-general@lists.postgresql.org; Wed, 14 Nov 2018 00:00:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gMibU-0002up-74 for pgsql-general@postgresql.org; Wed, 14 Nov 2018 00:00:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wAE00GWp027284; Tue, 13 Nov 2018 19:00:16 -0500 From: Tom Lane To: =?UTF-8?Q?R=C3=A9mi_Cura?= cc: PostgreSQL General Subject: Re: TOAST : partial detoasting : only a small part of a toasted value (for pgpointcloud) In-reply-to: References: Comments: In-reply-to =?UTF-8?Q?R=C3=A9mi_Cura?= message dated "Tue, 13 Nov 2018 18:53:51 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27282.1542153616.1@sss.pgh.pa.us> Date: Tue, 13 Nov 2018 19:00:16 -0500 Message-ID: <27283.1542153616@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?UTF-8?Q?R=C3=A9mi_Cura?= writes: > So the pgpointcloud store sometimes very large groups of points into one > row (TOASTED), something along few kB to few MB. TOAST would be in EXTERNAL > mode (no compression). > Sometimes we only want to access a part of this data (one or several blocks > within the full data). >> From what I understand, for the moment it requires to fetch all the data > from disk, then de-toast it, then select only the part of the data we are > interested in. > Yet I think it is possible to detoast only a subset of the data (and thus > fetch only some part of the data), considering that the [doc on toast]( > https://www.postgresql.org/docs/11/storage-toast.html) says >> " Use of EXTERNAL will make substring operations on wide text and bytea > columns faster >> (at the penalty of increased storage space) because these operations are > optimized >> to fetch only the required parts of the out-of-line value when it is not > compressed. " > So my question is how does it work, how easy would it be to implement for > pgpointcloud? See PG_DETOAST_DATUM_SLICE and users of that macro. regards, tom lane