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 1kkczY-0005d6-IR for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2020 01:01:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkczX-0003ga-FC for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Dec 2020 01:01:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkczX-0003gT-1O for pgsql-hackers@lists.postgresql.org; Thu, 03 Dec 2020 01:01:03 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kkczT-0007LM-LW for pgsql-hackers@lists.postgresql.org; Thu, 03 Dec 2020 01:01:01 +0000 Received: by mail-pj1-x1030.google.com with SMTP id f14so153529pju.4 for ; Wed, 02 Dec 2020 17:00:59 -0800 (PST) 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=A2/ZGowMi/0GxsUK6+4qVmOZrwNPNT0JZdKM2zdh1d0=; b=CTi3eD3nj49YUKxf1IGJBDr7y/jQs8nuejTrDBfHRnoYoSjuVxx6PQchj61Nrfg6h5 MhRRtzxz+dTWY5sfVVWkmayl6EhnHnIDPN8DpHkmbHS0VYq230y7nvZK2lFuiq+RLmle K4szCBysDl2vHZygnbnAkYmoAdqbxJc3QQ23ZERPBjkcIUfsxPLoUB0JNhyWUCbbMQK7 Y7lToYk3ZxPqyp3GXFN2659TOckZyFEQjz6XhxTiSVHvY/JoAlcsP5t88f4yN206ko5R RcKLa0DD+n+6BVHWWfNhZ8Mhy3WraVR1C92hyqbRQHY9bM23IeUJTn7TyBUi98NoW3fi 7pig== 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=A2/ZGowMi/0GxsUK6+4qVmOZrwNPNT0JZdKM2zdh1d0=; b=AquFvz4ozkgRkxdRIt0VP5aiKGUyFXlgZt2AJdP55NgkbzSWRw2Px4s7BnjASxl7Wj fszKvu9YNk2P0UUfQQQOmb6RKHftxxvOIXJL0F12VrS5hY9B0b6Y7/4dV05UJjkMozuP y0BlWQkcQE8CgNOoP5fGYg9yu0SFR21Wfme2+c8y7lB6299Z11mmF4Dv15fDmmh4uD2Y 3486KGyZYlaz6cgOk9m2Es2ExVwVKZ8tjXE2PY0YldNNivqvVnQduCqc6FRkSMkXJsYz cXnyQa0haWNySvbkxD+gzeSvZdrV58EGZoat/q0ioIVAeMJruCD4APiozYCNVOe7M16D SF1Q== X-Gm-Message-State: AOAM533ylJH/bKFAswk9JV77IyeYMxKi7QVkv710JDI7tFhdOS8xcXnT KMYbkNo3Tlrs1MJUjDLfpK0= X-Google-Smtp-Source: ABdhPJz91yLSHFXfULgZIvgguPxBBU2dnskdl+Od+EJNTLTJuNlJy45Lqp/DkrjDS/TtJkYy0TfynA== X-Received: by 2002:a17:902:c583:b029:da:b32c:cf9f with SMTP id p3-20020a170902c583b02900dab32ccf9fmr811521plx.44.1606957258353; Wed, 02 Dec 2020 17:00:58 -0800 (PST) Received: from nol (36-228-92-107.dynamic-ip.hinet.net. [36.228.92.107]) by smtp.gmail.com with ESMTPSA id n20sm200611pgb.77.2020.12.02.17.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 17:00:57 -0800 (PST) Date: Thu, 3 Dec 2020 09:00:51 +0800 From: Julien Rouhaud To: Nikolay Samokhvalov Cc: PostgreSQL Hackers Subject: Re: pg_stat_statements oddity with track = all Message-ID: <20201203010051.GA8050@nol> References: <20201202040516.GA43757@nol> <20201202063241.GA51769@nol> 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: Precedence: bulk On Wed, Dec 02, 2020 at 06:23:54AM -0800, Nikolay Samokhvalov wrote: > On Tue, Dec 1, 2020 at 10:32 PM Julien Rouhaud wrote: > > > On Tue, Dec 01, 2020 at 10:08:06PM -0800, Nikolay Samokhvalov wrote: > > > If all top-level records in pg_stat_statements have "true" in the new > > > column (is_toplevel), how would this lead to the need to increase > > > pg_stat_statements.max? The number of records would remain the same, as > > > before extending pg_stat_statements. > > > > If the same query is getting executed both at top level and as a nested > > statement, two entries will then be created. That's probably unlikely for > > things like RI trigger queries, but I don't know what to expect for client > > application queries. > > > > Right, but this is how things already work. The extra field you've proposed > won't increase the number of records so it shouldn't affect how users > choose pg_stat_statements.max. The extra field I've proposed would increase the number of records, as it needs to be a part of the key. The only alternative would be what Fufi-san mentioned, i.e. to split plans and calls (for instance plans_toplevel, plans_nested, calls_toplevel, calls_nested) and let users compute an approximate value for toplevel counters.