Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dh4fO-000860-4n for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2017 01:59:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dh4fN-0007Nm-06 for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2017 01:59:41 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dh4fK-0007BU-D8 for pgsql-hackers@postgresql.org; Mon, 14 Aug 2017 01:59:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dh4fH-0001Od-7f for pgsql-hackers@postgresql.org; Mon, 14 Aug 2017 01:59:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v7E1xUHN032139; Sun, 13 Aug 2017 21:59:30 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , Thomas Munro , Dilip Kumar , Pg Hackers Subject: Re: shared memory based stat collector (was: Sharing record typmods between backends) In-reply-to: <20170814005656.d5tvz464qkmz66tq@alap3.anarazel.de> References: <20170814005656.d5tvz464qkmz66tq@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sun, 13 Aug 2017 17:56:56 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32137.1502675970.1@sss.pgh.pa.us> Date: Sun, 13 Aug 2017 21:59:30 -0400 Message-ID: <32138.1502675970@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > You both are obviously right. Another point of potential concern could > be that we'd pretyt much fully rely on dsm/dht's being available, for > the server to function correctly. Are we ok with that? Right now > postgres still works perfectly well, leaving parallelism aside, with > dynamic_shared_memory_type = none. In principle we could keep the existing mechanism as a fallback. Whether that's worth the trouble is debatable. The current code in initdb believes that every platform has some type of DSM support (see choose_dsm_implementation). Nobody's complained about that, and it certainly works on every buildfarm animal. So for all we know, dynamic_shared_memory_type = none is broken already. > I think there's two other relevant points here: > a) It'd be quite useful to avoid needing a whole cluster's stats in > memory. Even if $subject would save memory, I'm hesitant committing > to something requiring all stats to be in memory forever. As a first > step it seems reasonable to e.g. not require state for all databases > to be in memory. The first time per-database stats are required, it > could be "paged in". Could even be more aggressive and do that on a > per-table level and just have smaller placeholder entries for > non-accessed tables, but that seems more work. Huh? As long as we don't lock the shared memory into RAM, which on most platforms we couldn't do without being root anyway, ISTM the kernel should do just fine at paging out little-used areas of the stats. Let's not reinvent that wheel until there's demonstrable proof of need. > b) I think our tendency to dump all stats whenever we crash isn't really > tenable, given how autovacuum etc are tied to them. Eh, maybe. I don't think crashes are really so common on production systems. As developers we have an inflated view of their frequency ;-) regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers