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 1pKqCk-0000IV-L4 for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 00:33:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKqCj-0004Rh-Ck for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 00:33:25 +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 1pKqCj-0004R9-1n for pgsql-hackers@lists.postgresql.org; Thu, 26 Jan 2023 00:33:25 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pKqCg-0007sb-Lz for pgsql-hackers@postgresql.org; Thu, 26 Jan 2023 00:33:24 +0000 Received: by mail-pl1-x636.google.com with SMTP id d3so508128plr.10 for ; Wed, 25 Jan 2023 16:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tUTVMf69cJdUvItz2KOQ1+cbDN6q+vMcI9q9ndH0QcM=; b=exIZ7VPVg61xx3sAEiiFQXxltzZcNrcCNTyxgJC+BSzpbHv/KgOBtzKQ0JXWJzN/RA c5CBJoShyBIlknuR79VAAJe4XCRWy0GMpYiVb3KpsfKPYxADQ7waQ+pkaFVCIs2y/Pvp 4UnlXYVxvz7geajzI7LZDH1D7qAg3lt8EH9X4zUtDiz7hnGj22D14Xb8t22MU3HIUnHw IsjWYstzhZMjS/sqbpw33rH8VKDoa2rV4yAOGJcrNT5ZzVlg8IPH0hub2nUehdTTg5SS aX/Jt9lQwQMAJfv23OhLQIgtG++hkWILjMr+AtkWuXnu6ybEbl5oqPMEVjV8yST1QMNO eyQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tUTVMf69cJdUvItz2KOQ1+cbDN6q+vMcI9q9ndH0QcM=; b=ujfC0r9ItBb+EV1dX5ksiMfJaaYWYWSKLK5ljgvZ5iD087ybrvQ2fiZWFeCbbdvLI0 BOqpIyXt6XOIeWS+ePFQKQ+80rI0zAnLkZJVibE2haMMt78pF+31xOSn2Da5iMpM6iaj 7f4DK8nKRyh0ACMKZhV2cUIuJKNYBCL9FP6ii3vZsB2vUoYxvRHw7k66t5xCwEzfomzb jJHju8IA3X7Xbl1jPb8yLSS5vG0UN8L+cFQck/A8xo4jQ32Vq055MpPA91+vqdEbl6VL h+dHyjCTecP6hMunG7da/fSPhh7Dat9npV4BUMAiOddFc3IscGFDDPm+kK0Btl6gg6B3 voLA== X-Gm-Message-State: AFqh2kqdlYjsTDlobghJIzPMxTZdFf18e1H5/wtlMVhv4JtV3PYOZt1P whjQv2QFRrOSzjCRP8Oy0h8= X-Google-Smtp-Source: AMrXdXunaqvZ/eE6UPIe3xl1AhIwqxTbVRJRt66IR7s0ZAtBdwpsnHu22uLNXq5Yzb2carAavT5sjA== X-Received: by 2002:a17:902:b702:b0:186:8568:be7e with SMTP id d2-20020a170902b70200b001868568be7emr35343134pls.15.1674693201709; Wed, 25 Jan 2023 16:33:21 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id je14-20020a170903264e00b001895d87225csm4254700plb.182.2023.01.25.16.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 16:33:20 -0800 (PST) Date: Wed, 25 Jan 2023 16:33:19 -0800 From: Nathan Bossart To: Thomas Munro Cc: Tom Lane , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@postgresql.org" Subject: Re: suppressing useless wakeups in logical/worker.c Message-ID: <20230126003319.GA1507251@nathanxps13> References: <20221202195503.GD2277157@nathanxps13> <20221205173523.GA2714833@nathanxps13> <20230109174217.GA1112698@nathanxps13> <2557815.1674603908@sss.pgh.pa.us> <20230125235004.GA1327755@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 26, 2023 at 01:23:41PM +1300, Thomas Munro wrote: > Can we also use TimestampDifferenceMilliseconds()? It knows about > rounding up for WaitLatch(). I think we might risk overflowing "long" when all the wakeup times are DT_NOEND: * This is typically used to calculate a wait timeout for WaitLatch() * or a related function. The choice of "long" as the result type * is to harmonize with that. It is caller's responsibility that the * input timestamps not be so far apart as to risk overflow of "long" * (which'd happen at about 25 days on machines with 32-bit "long"). Maybe we can adjust that function or create a new one to deal with this. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com