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.92) (envelope-from ) id 1jG1lN-0007Pe-LD for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Mar 2020 14:39:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jG1kM-0008Ht-Tb for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Mar 2020 14:38:38 +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 1jG1kM-0008Hk-H1 for pgsql-hackers@lists.postgresql.org; Sun, 22 Mar 2020 14:38:38 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jG1kI-0005VA-Kk for pgsql-hackers@postgresql.org; Sun, 22 Mar 2020 14:38:37 +0000 Received: by mail-qt1-x833.google.com with SMTP id m33so9430689qtb.3 for ; Sun, 22 Mar 2020 07:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SRP7lBepMMc6ExWsrSUda/hNj4fGKiQFGPXyqx1sA20=; b=h/0HoHCjAMvkSVDwETfVcVJKKNVZgljh/DBxOaNuYScUn3BfMiR96K8NE6o2XVQrg7 wYnolv/jX5E8X+UMIZcNwrDJWk9i4lJ9/fcoUR8d8PpKF1lGDeFt2Q/NsuKrRzVyfZRR KnMnAOOFyFj4PHkuVXQaLj9OJ+ZNkknCr+4iZamcrqDI4J3Au59Ejzl6z+jgZsHpWYlx XjWlyRqJ6jvSBT1vBLIVf772UoMlbvTMxmACJOz+ixIOZzInryBCp5Z6jRkcTGw/vTfY BxB55rgHyG4sZi/O2wccjfLDR60UI9Khf8GYdljwNz2gjNsiKtFj59BDhg/CS2y5fjTj 6QHQ== 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:user-agent; bh=SRP7lBepMMc6ExWsrSUda/hNj4fGKiQFGPXyqx1sA20=; b=KUa1j5/Dch6NyNK7cij7KxGFZFwO56wkBvsex3alBkfyIYAq24EHS5DGfKEInJM3R5 pMa64qhBSQWqLjcjKxAiHNVxhQPmA5EiY5dHJrZOC/R4VOA3oisCOE/zQEMaL5bqiXEM mpLhpji0kOEZJpofwmn9BJeNCLTl4NQ+ALHQjWddwVFsVGmKK94SAvlforn1uUTRza/4 oOPZYagxeXYequdZlsBSEoanuwPzeHqTI8bjPF6g1Y9EvlMVvVC/nrAjTgjuEFnYa4FZ Aio+kvFkOaQKjrKOZIypWSkx4qwY06GmT6Dz8IFPCEAgSSbTirAluYB34On+6FXP4zgA Q6YQ== X-Gm-Message-State: ANhLgQ3/N871N3KIn8oqofP890ukKejE7GyuqV6QaUW1R4uNsF5T6/oy JTcvgsSONNkxZ0Qu4b/sslmhXA== X-Google-Smtp-Source: ADFU+vuaBv+VPE27Y6cMz61WjEYf/0JNw8Kt4oPSIH0XoneILOHMXThSMOOEGnqv55sD7eHZn4EpKA== X-Received: by 2002:ac8:340d:: with SMTP id u13mr17478177qtb.235.1584887912080; Sun, 22 Mar 2020 07:38:32 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id m65sm9244545qke.109.2020.03.22.07.38.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Mar 2020 07:38:31 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 53710800CF1; Sun, 22 Mar 2020 09:38:29 -0500 (CDT) Date: Sun, 22 Mar 2020 09:38:29 -0500 From: Justin Pryzby To: Andres Freund Cc: pgsql-hackers@postgresql.org Subject: Re: Why does [auto-]vacuum delay not report a wait event? Message-ID: <20200322143829.GD2563@telsasoft.com> References: <20200319224449.pbjrivflbf4x76tj@alap3.anarazel.de> <20200321040750.GD13662@telsasoft.com> <20200322002457.dvepqpj4legcmuxn@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200322002457.dvepqpj4legcmuxn@alap3.anarazel.de> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Mar 21, 2020 at 05:24:57PM -0700, Andres Freund wrote: > > Also, I noticed that SLEEP_ON_ASSERT comment (31338352b) wants to use pg_usleep > > "which seems too short.". Surely it should use pg_sleep, added at 782eefc58 a > > few years later ? > > I don't see problem with using sleep here? There's no problem with pg_sleep (with no "u") - it just didn't exist when SLEEP_ON_ASSERT was added (and I guess it's potentially unsafe to do much of anything, like loop around pg_usleep(1e6)). I'm suggesting it *should* use pg_sleep, rather than explaining why pg_usleep (with a "u") doesn't work. > > Also, there was a suggestion recently that this should have a separate > > vacuum_progress phase: > > |vacuumlazy.c:#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */ > > |vacuumlazy.c:pg_usleep(VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL * 1000L); > > > > I was planning to look at that eventually ; should it have a wait event instead > > or in addition ? > > A separate phase? How would that look like? We don't want to replace the > knowledge that currently e.g. the heap scan is in progress? I don't think that's an issue, since the heap scan is done at that point ? heap_vacuum_rel() (the publicly callable routine) calls lazy_scan_heap (which does everything) and then (optionally) lazy_truncate_heap() and then immediately afterwards does: pgstat_progress_update_param(PROGRESS_VACUUM_PHASE, PROGRESS_VACUUM_PHASE_FINAL_CLEANUP); ... pgstat_progress_end_command(); > > VACUUM VERBOSE wouldn't normally be run with cost_delay > 0, so that field will > > typically be zero, so I made it conditional > > I personally dislike conditional output like that, because it makes > parsing the output harder. I dislike it too, mostly because there's a comment explaining why it's done like that, without any desirable use of the functionality. If it's not useful for a case where the field is typically zero, it should go away until its utility is instantiated. -- Justin