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 1rDSyj-0026TP-RX for pgsql-admin@arkaria.postgresql.org; Wed, 13 Dec 2023 17:25:01 +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 1rDSyi-00G2LC-JZ for pgsql-admin@arkaria.postgresql.org; Wed, 13 Dec 2023 17:25:00 +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 1rDSyi-00G2KG-8o for pgsql-admin@lists.postgresql.org; Wed, 13 Dec 2023 17:25:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDSyf-00AEHF-P0 for pgsql-admin@lists.postgresql.org; Wed, 13 Dec 2023 17:24:59 +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 3BDHOu2g2620243; Wed, 13 Dec 2023 12:24:56 -0500 From: Tom Lane To: Sbob cc: Pgsql-admin Subject: Re: Best way to parse complex json string into table columns? In-reply-to: References: Comments: In-reply-to Sbob message dated "Wed, 13 Dec 2023 09:55:15 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2620241.1702488296.1@sss.pgh.pa.us> Date: Wed, 13 Dec 2023 12:24:56 -0500 Message-ID: <2620242.1702488296@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sbob writes: > I have a client that is using a function to parse a set of rows from a > table with a json column into table columns in a materialized view. > ... > The above approach is painfully slow, is there a better performing > method of converting json strings to table columns? json[b]_populate_record is meant for this sort of thing. Also, if your source data is actually json not jsonb, that's a seriously poor choice when you are in need of better processing speed. regards, tom lane