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 1ldBYQ-0006Ep-51 for pgsql-general@arkaria.postgresql.org; Sun, 02 May 2021 12:50:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ldBYN-0004gn-AD for pgsql-general@arkaria.postgresql.org; Sun, 02 May 2021 12:50:31 +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 <9erthalion6@gmail.com>) id 1ldBYM-0004gf-WA for pgsql-general@lists.postgresql.org; Sun, 02 May 2021 12:50:31 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1ldBYH-0000fA-DC for pgsql-general@postgresql.org; Sun, 02 May 2021 12:50:30 +0000 Received: by mail-ej1-x630.google.com with SMTP id t4so3923387ejo.0 for ; Sun, 02 May 2021 05:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Q2FCSie2BZxv8UZ47Erhub7MLP9+fZhSOTal8oII37M=; b=d1gbDp8ZtAADOxnb3IO1aDDZWsFQsm+93C6Fs7iEW8nLju1yfU4dKHP6CZnFYTE9WA h9oplSJl3E9gd2F6fUghpUbxBLAtcD9064G3sxQEmQ8xJhr4D302ey9/gQXN77wopr2L EWK07tf9ILNaiidn066PkzOcIFUGmebKznHA/GQifVmFHi07euS6zJA+fMLRaQyRM+Xn 39qmRANJ4+DMSvz7S5AQOXFAFEuvqKOcxbzAOoR7k51YaTU6vjc4+Ls+x8NxoLM3lWl5 FPFg00Uy9ztpasmhg0GOFVVVQ/EHui7oxjJ/50WRE4Z/CVvNaMRVPuutcgh2HxBRjbzz zgkg== 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:in-reply-to; bh=Q2FCSie2BZxv8UZ47Erhub7MLP9+fZhSOTal8oII37M=; b=iLwZfgmpeZeOG//7lq78rjfe/qf/s+kKVvGQgSkOQ6NsZdR+Q9rSU0S+dGBPOGneIX GB5jvpp8NvnIstVPCUREZPt1WdtQjFGd5z+X44qPkYEQh0fu/ZrwU8yslXts2UeMkehA MS8Drord5unYwQeM0oMsr7urMve97IQtZkev4cQEQUNisBlz+wxWUQ/Yf4saKc/1K0XD 2fLrGrjlW/ZBPN7HQrlrc99+lWCbatUsAhYUOtvyFcgWYJuyndunvJ+aYR+U9C36F+1t hO1ZVmmk+Q3GqvVKg6mFWVBM9Qc8jYJ32QbuaiOl8rv4FP/kwvSv/CpP9cPBjNvSN8mm d1dA== X-Gm-Message-State: AOAM533OJFPd4nzFJt8o9OQs2lFCXE9EgeVPpfqY1WWzNCkD9Y3jnaFD npHV25/vw6vIStN1oacTVw0= X-Google-Smtp-Source: ABdhPJzwt8hRAPVz3kQSdCPN0JkMPV2W8YrMZpFVcA1QtWbLKOXtGlnjcktHfU/YywgfMfFhBrFlmQ== X-Received: by 2002:a17:907:a076:: with SMTP id ia22mr12505323ejc.233.1619959823966; Sun, 02 May 2021 05:50:23 -0700 (PDT) Received: from localhost (dslb-178-012-047-165.178.012.pools.vodafone-ip.de. [178.12.47.165]) by smtp.gmail.com with ESMTPSA id t7sm9118420eds.26.2021.05.02.05.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 May 2021 05:50:23 -0700 (PDT) Date: Sun, 2 May 2021 14:50:47 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Mitar Cc: Tom Lane , pgsql-general@postgresql.org Subject: Re: Why is writing JSONB faster than just JSON? Message-ID: <20210502125047.vzsksguxxzv34vio@localhost> References: <20210414084845.rkbe525twb4jr4fw@localhost> <3488585.1618410383@sss.pgh.pa.us> <20210415154311.t3meozbednmsfhxx@localhost> <3785442.1618505245@sss.pgh.pa.us> <20210415191140.pu4jukp6245wkzit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, Apr 23, 2021 at 01:56:57AM -0700, Mitar wrote: > Hi! > > On Thu, Apr 15, 2021 at 12:11 PM Dmitry Dolgov <9erthalion6@gmail.com> wrote: > > > My point was that for JSON, after validating that the input is > > > syntactically correct, we just store it as-received. So in particular > > > the amount of whitespace in the value would depend on how the client > > > had chosen to format the JSON. This'd affect the stored size of > > > course, and I think it would have an effect on compression time too. > > > > Yes, I got it and just wanted to confirm you were right - this was the > > reason I've observed slowdown trying to reproduce the report. > > Thank you for trying to reproduce the report. I did a bit more digging > myself and I am still confused. > > ... > > So I do not know what is happening and why you cannot reproduce it. Could you maybe get a profile with perf for both cases? Since they're executed within a single backend, you can profile only a single pid. Having a reasonable profiling frequency, --call-graph dwarf and probably limit events to only user space with precise tagging (cycles:uppp) should give an impression what's going on.