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 1nL6NT-0003QR-Cj for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Feb 2022 16:45:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nL6NS-0004Wa-73 for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Feb 2022 16:45:02 +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 1nL6NR-0004W6-SA for pgsql-hackers@lists.postgresql.org; Fri, 18 Feb 2022 16:45:01 +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 1nL6NP-00065G-8Z for pgsql-hackers@postgresql.org; Fri, 18 Feb 2022 16:45:00 +0000 Received: by mail-pj1-x1030.google.com with SMTP id t14-20020a17090a3e4e00b001b8f6032d96so9051939pjm.2 for ; Fri, 18 Feb 2022 08:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DLzC7KhPKNJWX670QlMXQsPHeghjr5kJ6LFqiXY0vfQ=; b=MIwSqLG8v7yBGzlRv5NB/snPGnoLmYJhSNGyPFALovKku5LEk9qSoD+hRPLnBJFP69 Iy88FTJR3reqBaJi6t7deXWZV15xqiT+lHB2jjXmE9OELyFagUq7aUoDjAgji2bipP17 r78Pik6kUGPhsJ7oS2h8ApR4UwKW2MAOJbzETwFFaaTtb35Plr+V8FYLZg34OH5HmfGY h5GrgPNipSFVi6vc6+wXD2/GAfqls0a2ypxoGZOJdUEFhNCkVPxAvbS2tlpdgRFqFemL ghbf6XhRNstcq56CP0cwReq6GsAQ6/Tvu9afdeW7NJX2IZ10A+r5FOUc/ac86QPLdTsI 32Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DLzC7KhPKNJWX670QlMXQsPHeghjr5kJ6LFqiXY0vfQ=; b=By+7PEh388ENYKdnOJWkChhrSoon0LxykH9ElCxXr+hMKyj1a+33n9u/XSnNkAK9kA MrG7TjLOQlTxl7RsqqMclL/qCjLW2+MGucvcTzhajd4XJGWvnqNZtCbZS0kiZpve586v /0/3PaaBvYIUv1/wxHrHhpu8q5b76Q9q08DV6sTaZihWM4Q8BaG/5ttXNi1c5CeJb4kD YVO7twDXhYoWlIqLxL56InMlTJZ6uir3qpTIN9d5dnncTdvclnjXSUhIna10Z9jRfe6L m4CHWNr96oQKRcTsZZi4D94nSgHdJylfj83uyEuXCb48wuv/8mHjFOsm/3UXFuKGwZXv BZgg== X-Gm-Message-State: AOAM532l3dqtnCEP0TzrUVgF4tKeXlDyx9i/6S8dJrzYlghixZxlRGnX xloCHtv6JVSOZXBupo2EoDs= X-Google-Smtp-Source: ABdhPJxsZqqyb0+ZXwVydrKlk+Ke5HbK6hJdBrZ44GlnZUViUSNgSH01ig6hrAdr1FOGmNWkc5n8og== X-Received: by 2002:a17:90b:4c0d:b0:1b8:cc2e:93f2 with SMTP id na13-20020a17090b4c0d00b001b8cc2e93f2mr13394752pjb.68.1645202698135; Fri, 18 Feb 2022 08:44:58 -0800 (PST) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id em22sm5947276pjb.35.2022.02.18.08.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 08:44:57 -0800 (PST) Date: Fri, 18 Feb 2022 08:44:54 -0800 From: Nathan Bossart To: Andres Freund Cc: "Bossart, Nathan" , Bharath Rupireddy , Maxim Orlov , Amul Sul , Bruce Momjian , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: O(n) tasks cause lengthy startups and checkpoints Message-ID: <20220218164454.GA3403811@nathanxps13> References: <20220217005057.GA3201038@nathanxps13> <20220217015052.2y3wxibeommk37ey@alap3.anarazel.de> <20220217041404.GA3243546@nathanxps13> <20220217065938.x2esfdppzypegn5j@alap3.anarazel.de> <20220217182337.GA3247866@nathanxps13> <20220217192709.eyf2cnymhxqsals7@alap3.anarazel.de> <20220217210022.GA3248793@nathanxps13> <20220217222829.lndzwq72fh4v34c2@alap3.anarazel.de> <20220217225838.GA3292179@nathanxps13> <20220217231247.llfqjvvuk6rkawel@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220217231247.llfqjvvuk6rkawel@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Feb 17, 2022 at 03:12:47PM -0800, Andres Freund wrote: >> > The improvements around deleting temporary files and serialized snapshots >> > afaict don't require a dedicated process - they're only relevant during >> > startup. We could use the approach of renaming the directory out of the way as >> > done in this patchset but perform the cleanup in the startup process after >> > we're up. >> >> Perhaps this is a good place to start. As I mentioned above, IME the >> temporary file cleanup is the most common problem, so I think even getting >> that one fixed would be a huge improvement. > > Cool. Hm. How should this work for standbys? I can think of the following options: 1. Do temporary file cleanup in the postmaster (as it does today). 2. Pause after allowing connections to clean up temporary files. 3. Do small amounts of temporary file cleanup whenever there is an opportunity during recovery. 4. Wait until recovery completes before cleaning up temporary files. I'm not too thrilled about any of these options. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com