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 1oEF4G-00027C-W4 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 19:09:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oEF4F-0008W5-Mp for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 19:09:07 +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 ) id 1oEF4E-0008Qj-NP for pgsql-hackers@lists.postgresql.org; Wed, 20 Jul 2022 19:09:07 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEF4B-0000OQ-J1 for pgsql-hackers@lists.postgresql.org; Wed, 20 Jul 2022 19:09:06 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id DF148320093D; Wed, 20 Jul 2022 15:08:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 20 Jul 2022 15:08:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1658344138; x= 1658430538; bh=l7dyrD704bGGQADd3KhCi6Ujirjto6f/g1/tE0ymM2w=; b=m DILTnGwsc6lWCXKJ5hzufBpKzPp4TG2Jfo1wtBkXpuQuhoBse9JKNn8J0oKK+K50 FiuQwaXqirUmQEh6Y5cBu9DOnpZ6Djh/kAbLO7V7Vbm5sAKcwKTbE4rEZv44VuNJ JkKYQbOxJ+k6yUbVCUqIF4niYBa13XHaQObmib4/6n9WRh/WwaU7KMreT/uEkkGX QwF4DuTFa5ad+N7xpNglp9yEpTfakWhU3xpQCdPyinNYPNvdQGC414acJQCHYPMH vjrq8UcT1Y4P6b6nuSQD5GIRKOZVMP/LD325qaAfCxkCZGnW8QAtkVXmFpBa0v6x 6iegE8McDrvRB+WG5nDzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1658344138; x= 1658430538; bh=l7dyrD704bGGQADd3KhCi6Ujirjto6f/g1/tE0ymM2w=; b=N 1GS8O14TlfN4jy8rg298jCNYiYbY/Ujwx+wWhANV2zSj568j9bizhM3DbERaeaNf fZWpiYA236rIu8UeznxV1pHRIAvnbfiXUaHar5x9FdsX2vBMw9lGbfWmAuefbjYh 4clIv1WEKv4S6+NqUer59Nx802tlLEggh1sPGJ8u/zDuQkN+lQp/1/hja5zlrUEL S4OEtIdq/52czpOHd9SUBHLHDP7wFx09n0/6VDaqjQu7ZjuZ40QjJum1CkPV8PS4 4veUJVfdZjhG1uk4TFLIFeqvYqY8cUvNsslU4j4nanPY482pSikl240NCCbavJB9 0ONr+k1EmE3+YiqM92deA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudelvddgudefiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomheptehn ughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecugg ftrfgrthhtvghrnhephffgkeehtedtgeevvedttdfhleeuheejvdetveffhffgjeduieeg jeegkeeitdffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Jul 2022 15:08:56 -0400 (EDT) Date: Wed, 20 Jul 2022 21:08:49 +0200 From: Andres Freund To: Greg Stark , Tom Lane CC: Melanie Plageman , Kyotaro Horiguchi , Justin Pryzby , Thomas Munro , "David G. Johnston" , PostgreSQL Hackers Subject: Re: shared-memory based stats collector - v70 User-Agent: K-9 Mail for Android In-Reply-To: References: <20220317073652.kz3uuh6le6vbfod4@alap3.anarazel.de> <20220325.142256.1649716600998659084.horikyota.ntt@gmail.com> <20220325.172418.1055357550509939415.horikyota.ntt@gmail.com> <20220402082102.ojdd2e6cobsmljvh@alap3.anarazel.de> <20220404041516.cctrvpadhuriawlq@alap3.anarazel.de> <20220405030506.lfdhbu5zf4tzdpux@alap3.anarazel.de> <20220406030008.2qxipjxo776dwnqs@alap3.anarazel.de> <1736122.1658333315@sss.pgh.pa.us> Message-ID: <83D73EC0-E3ED-4C98-A528-5E122278D553@anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi,=20 On July 20, 2022 8:41:53 PM GMT+02:00, Greg Stark wrote: >On Wed, 20 Jul 2022 at 12:08, Tom Lane wrote: >> >> AFAIR, the previous stats collector implementation had no such provisio= n >> either: it'd just keep adding hashtable entries as it received info abo= ut >> new objects=2E The only thing that's changed is that now those entries= are >> in shared memory instead of process-local memory=2E We'd be well advis= ed to >> be sure that memory can be swapped out under pressure, but otherwise I'= m >> not seeing that things have gotten worse=2E > >Just to be clear I'm not looking for ways things have gotten worse=2E >Just trying to understand what I'm reading and I guess I came in with >assumptions that led me astray=2E > >But=2E=2E=2E adding entries as it received info about new objects isn't t= he >same as having info on everything=2E I didn't really understand how the >old system worked but if you had a very large schema but each session >only worked with a small subset did the local stats data ever absorb >info on the objects it never touched? Each backend only had stats for things it touched=2E But the stats collect= or read all files at startup into hash tables and absorbed all generated st= ats into those as well=2E >All that said -- having all objects loaded in shared memory makes my >work way easier=2E What are your trying to do?=20 >It actually seems feasible to dump out all the >objects from shared memory and including objects from other databases >and if I don't need a consistent snapshot it even seems like it would >be possible to do that without having a copy of more than one stats >entry at a time in local memory=2E I hope that doesn't cause huge >contention on the shared hash table to be doing that regularly=2E The stats accessors now default to not creating a full snapshot of stats d= ata at first access (but that's configurable)=2E So yes, that behavior is p= ossible=2E E=2Eg=2E autovac now uses a single object access like you descri= be=2E Andres --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E