Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t6Jip-00C7ao-4J for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Oct 2024 01:11:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t6Jin-00EANe-6A for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Oct 2024 01:11:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t6Jim-00EAMQ-8R for pgsql-hackers@lists.postgresql.org; Thu, 31 Oct 2024 01:11:33 +0000 Received: from m16.mail.163.com ([117.135.210.2]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t6Jib-003i2R-IK for pgsql-hackers@lists.postgresql.org; Thu, 31 Oct 2024 01:11:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=vGJELi+4x2neIpSR7CXmZjyKB1cBPWMP6dV1OX9mNEc=; b=XV0T+Pbd0FK+BBdePosel6w/3//F5FriFT4fUgioT4+kHHx7zaJ4EKQv3+ATHI nkiIQiP207tH8g8ot8maqCKsWptvYr+ww06E4FgmfNr5DwlVpsZgzqphgaAFtpl0 Na7IU19VefmRdnEENMSmAyDUKnUTrSSzNQb3B+ikxcP88= Received: from lovely-coding (unknown [101.227.46.166]) by gzga-smtp-mtada-g0-0 (Coremail) with SMTP id _____wDnFwQy2SJnWs18CQ--.60332S3; Thu, 31 Oct 2024 09:11:15 +0800 (CST) From: Andy Fan To: Nikita Malakhov Cc: PostgreSQL Hackers Subject: Re: Avoid detoast overhead when possible In-Reply-To: (Nikita Malakhov's message of "Wed, 30 Oct 2024 14:22:42 +0300") References: <87ttoyihgm.fsf@163.com> <87plzmia7e.fsf@163.com> <87h68u8nqj.fsf@163.com> Date: Thu, 31 Oct 2024 09:11:14 +0800 Message-ID: <878qu56pql.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID:_____wDnFwQy2SJnWs18CQ--.60332S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7urWDCrWrAr47tryUZr15twb_yoW8Zr4DpF W5KrnxCr4DZ34Iyr1vvw1xAa4Iyrn3Cr45GF9Yg3y8Wr45XryIqF1ftrZ8XFW7urWfurs2 vw409ry8A3WkZaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRrR6xUUUUU= X-Originating-IP: [101.227.46.166] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/1tbioBuJU2ci0QeVUAAAs3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nikita Malakhov writes: > 1) In short the idea behind the Json improvements is to introduce iterators > for Json objects to extract these objects value by value, OK here. > and modification > of in-memory and on-disk representations to hold partially-detoasted Json > objects (tree nodes with need-detoast state) for in-memory, and to store > key-value map in on-disk representation to extract only required > values. I have troubles to follow here. Could you explain this more for the below example, What will be done differently from current in the below example: CREATE TABLE t(jbcol jsonb); INSERT INTO t values ('{"a": 1, "b": 2}'); // new storage format? SELECT jbcol->'a', jbcol->'b' FROM t; // How does ExprInterp.c work with this? > 2) Backward compatibility would not be a problem because in on-disk > representation we could distinguish old version from new. OK, so you indeed change the storage format, if so, How is the new format looks like? It would be an important factor to discuss. > there are enough service bits for that. OK, good news. > But servers not updated with this patch could not parse new data, of > course. This looks too for me. > > 3) Yes, it definitely has to. These changes are very complex and invasive, > that's the reason I haven't finished the patch. This is the area I am really worried about. I think you can have some high-level design document for review first. It would be great that some more experienced people could have a look at, however I know it is hard becuase of their bindwidth. You need that document anyway. Without the details, other people is hard to understand the idea in your mind. > > 4) It doesn't seem worthy at first glance. Do you have any ideas on > this? I think the more important ones are (a) what the new storage looks like, (b) how does it works with the ExprExecutionEnginner. Without that infromation, I think it is too soon to talk about this. -- Best Regards Andy Fan