Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nv2al-0004VA-H1 for pgsql-general@arkaria.postgresql.org; Sat, 28 May 2022 19:59:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nv2ak-00046v-4E for pgsql-general@arkaria.postgresql.org; Sat, 28 May 2022 19:59:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nv2aj-00044k-Q0 for pgsql-general@lists.postgresql.org; Sat, 28 May 2022 19:59:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nv2ah-0002Wt-C4 for pgsql-general@lists.postgresql.org; Sat, 28 May 2022 19:59:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 24SJxCfS3127819; Sat, 28 May 2022 15:59:12 -0400 From: Tom Lane To: Shaheed Haque cc: pgsql-general@lists.postgresql.org Subject: Re: JSONB index not in use, but is TOAST the real cause of slow query? In-reply-to: References: <3110295.1653763316@sss.pgh.pa.us> Comments: In-reply-to Shaheed Haque message dated "Sat, 28 May 2022 20:38:34 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3127817.1653767952.1@sss.pgh.pa.us> Date: Sat, 28 May 2022 15:59:12 -0400 Message-ID: <3127818.1653767952@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Shaheed Haque writes: > One last thought about TOAST. If the cost of the -> retrieving the > data cannot be obviated, is there any way to tweak how that works? The only thing that's readily tweakable is to disable data compression for the out-of-line values (see ALTER TABLE ... SET STORAGE, and note that you have to rebuild the table for already-stored values to be changed). It seems unlikely that that will help you much though, since doing that would save CPU at the cost of more disk I/O, and it seems that the I/O side is your bottleneck already. It *would* help if jsonb had logic for partial fetches, because that'd require uncompressed storage to work. But AFAICS that's not there yet. I distinctly recall that that was planned for when we were designing jsonb's on-disk layout, but I see no code actually doing anything of that sort ... the -> operator certainly doesn't. regards, tom lane