Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1im2ff-0000Nz-9G for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Dec 2019 21:33:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1im2fe-0001Z5-2p for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Dec 2019 21:33:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1im2fd-0001Xs-N7 for pgsql-hackers@lists.postgresql.org; Mon, 30 Dec 2019 21:33:49 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1im2fa-0003cP-Az for pgsql-hackers@lists.postgresql.org; Mon, 30 Dec 2019 21:33:49 +0000 Received: by mail-wm1-x342.google.com with SMTP id p9so592765wmc.2 for ; Mon, 30 Dec 2019 13:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gn2+wxxZcmBincjaJ6IzLpjChyZIfihL5tOe0k34Nfc=; b=H/UuhJ+kM6V8NQW3V0Pn6F7oLn2dwmaHhWbFJ9zyt/jrErodL6UmjAyOhg3F48JbAb y/pdwAT7XS2WyErYEuIVHZJuClwGqhuXsqvp3QKEKHAnpx6RdFmmVkvtJDHb+LjgYEXu VI+e3hOTmzd8DK5WwPJCwyyM4MZ0IPbTfd8ULaqTOYaUTzqraBNnOAaeMhaIx2pBzFEG b6WkkL/oy2ifjcUDb1afGjuOSvMOZ158nTuPrvaKtBm24NcDD81dkTrp9K144A3cw2Kt VfvHwc9nFdZoUuhJk8sMfmIxVS8W3fm3AJjFkLAVm83KBTPaY651T61xrcmB1B8/w+cb Eb8A== 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=gn2+wxxZcmBincjaJ6IzLpjChyZIfihL5tOe0k34Nfc=; b=rHyz5n2BbFx53Q7sadA1OjX/ucFc7zTV3W87LoVRdPA44oPKAuoil9xN8BkRZ6xmZm rTa8VlBmCDYRi8GSmKqG5fDTHZifKqDTpxs7T6ShVXGaSJ7lHeNDC3SlZTSuhdM2GCow P6VXymIei/xhvhSat3mxDnOlCMWF0ooDJ1EACbo2C2DIRDNLSIvahZW5HW6+tBe8b/Me VfPO/jSJpmPQSG6EasmIf5hcetvc3t14ojHxiVAwj9EnnQPW2PL6k+UZecsE9y/2mUle 406l7y7Sn6t+mpgoorj+CwqSsaQ6UC09jbLlyR+SixxnLTOC8CfsKU99B1RPGwDgsZSE iZyA== X-Gm-Message-State: APjAAAVZ1gRJQgD1eGTh5J5pTJXglFqvmAQ9hjnLUC4eJ0ZaxezuoPp/ 95OHogf0HsuQn+2TfoGKfuws2A== X-Google-Smtp-Source: APXvYqx3S9pnTW+tKorh1kdS/ubS5Xh0abfIuUwV6LCg5SBDRh9PM/WhjuG6qk8rS/uI0Wng6h/2SA== X-Received: by 2002:a7b:cc82:: with SMTP id p2mr820096wma.159.1577741624466; Mon, 30 Dec 2019 13:33:44 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id q68sm681707wme.14.2019.12.30.13.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 13:33:43 -0800 (PST) Date: Mon, 30 Dec 2019 22:33:42 +0100 From: Tomas Vondra To: Robert Treat Cc: Robert Haas , Tom Lane , Nikolay Samokhvalov , Michael Paquier , Bruce Momjian , Alexey Kondratov , v.makarov@postgrespro.ru, PostgreSQL Hackers Subject: Re: [PATCH] Increase the maximum value track_activity_query_size Message-ID: <20191230213342.jmtvp2kmqdtt55sp@development> References: <20191219154110.GL30116@momjian.us> <556.1576771167@sss.pgh.pa.us> <7a4ecea0-949e-efa7-865f-0ef2ddce52c3@postgrespro.ru> <20191220135704.GC29807@momjian.us> <20191221024757.GF15758@paquier.xyz> <25274.1576963505@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Dec 30, 2019 at 12:46:40PM -0800, Robert Treat wrote: >On Mon, Dec 23, 2019 at 9:11 PM Robert Haas wrote: >> >> On Sat, Dec 21, 2019 at 1:25 PM Tom Lane wrote: >> > > What is the overhead here except the memory consumption? >> > >> > The time to copy those strings out of shared storage, any time >> > you query pg_stat_activity. >> >> It seems like you're masterminding this, and I don't know why. It >> seems unlikely that anyone will raise the value unless they have very >> long queries, and if those people would rather pay the overhead of >> copying more data than have their queries truncated, who are we to >> argue? >> >> If increasing the maximum imposed some noticeable cost on >> installations the kept the default setting, that might well be a good >> argument for not raising the maximum. But I don't think that's the >> case. I also suspect that the overhead would be pretty darn small even >> for people who *do* raise the default setting. It looks to me like >> both reading and write operations on st_activity_raw stop when they >> hit a NUL byte, so any performance costs on short queries must come >> from second-order effects (e.g. the main shared memory segment is >> bigger, so the OS cache is smaller) which are likely irrelevant in >> practice. >> > >I'm generally in favor of the idea of allowing people to make >trade-offs that best work for them, but Tom's concern does give me >pause, because it isn't clear to me how people will measure the >overhead of upping this setting. If given the option people will >almost certainly start raising this limit because the benefits are >obvious ("I can see all my query now!") but so far the explanation of >the downsides have been either hand-wavy or, in the case of your >second paragraph, an argument they are non-existent, which doesn't >seem right either; so how do we explain to people how to measure the >overhead for them? > I think there are two questions that we need to answer: 1) Does allowing higher values for the GUC mean overhead for people who don't actually increase it? I don't think so. 2) What's the overhead for increasing the value for short/long queries? My assumption is that for short queries, it's going to be negligible. For longer queries it may be measurable, but I'd expect longer queries to be more expensive in general, so maybe it's still negligible. Of course, the easiest thing we can do is actually measuring this. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services