Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjEXD-00GbGY-Qr for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2024 09:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sjEXB-00284B-Rx for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2024 09:00:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjEXB-002843-Hj for pgsql-hackers@lists.postgresql.org; Wed, 28 Aug 2024 09:00:10 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sjEX4-001tZh-Tv for pgsql-hackers@postgresql.org; Wed, 28 Aug 2024 09:00:09 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5333b2fbedaso2126705e87.0 for ; Wed, 28 Aug 2024 02:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724835603; x=1725440403; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=S3LBzigCr4sM/gu3wkVBGKRmtW9fkt1f3iS9Vp/RD64=; b=cGGRL57BfwyFfWN2Ouk5WtqtSkoEflnmFpQOnLT2lrHOkKNbN5vGx1LV2EOYw5Z5aL OMWqlrHIPrxUJUOG4IqauEYDy3qYEurichQrvGhuoKKPvugcr9jTqnSHRCKvvpkkDiUI 8+izOqpEtVnZkoPx+tkx0AdXlSdE0WhpAgPY2p7prL9ejLfNO2pclmDFdjbVQ07qVIlB WsRiaIOrmUn6691OhnYxLPCTTsEE8vOkS2Grl9ZLGfDXWFhMlqufIa2SXSmWQiYZCTkI bPgYu/UQG4RMBaOCzTYqI5YBrdi8t6C1mBJQWoDnY0P21Rbp2LH0FXabzko6whfR0Z/z ZAzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724835603; x=1725440403; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=S3LBzigCr4sM/gu3wkVBGKRmtW9fkt1f3iS9Vp/RD64=; b=o5Yiwm34GNgSWR6Ssw2WuzYsrOwuIya1FTkZKdsINki2RYTBBotERq6Gcb+hCZn+Qm +5E6Pi/ol3/FZmMYfauh5KqledSg+NnF9bTQMntxXJ1IaKsezd1w8nCF9Iq2X7TDYFuL hjBDWCg4lAb71DQV3CI4hw/Puj78W/Y7eNduNL2AzpasuJAMamnmxm2kVqpa9VPdfhv4 pcJBOMvbRZEGU59LP6HqDQUwAQMezHzSGTw1UVPQCw6eIjxjaus4PgMwzHQQe9mKWua/ YXK5amewBA/Rt/8DSFjA/2f40GqS1XR8oLB0ss5p1i0R5pouZ4JY4QgmNrYQWA72BRPw C1qQ== X-Forwarded-Encrypted: i=1; AJvYcCXnZO0ETReGZQPi76Mu2PmZUROvcd7CBs6OowkejWwVwyBwlrJd5Lsz8znGPCwDXehcyc/VMuJ/63wtjQzD@postgresql.org X-Gm-Message-State: AOJu0Yzwjk7TfZAui4bKT1J8ZBn7ag5HH2KEr/KGfZmsXuJio5bU4B2u n1HKq58ZP904FsL/44FWkgWP84iS4LEWXlouIW0r2T4sG6H220TR X-Google-Smtp-Source: AGHT+IHtTv1xFy3yg7PcAbEG47J/er9DKZq6GlbP7a4/h8z2FQscJudgxoqvL4cLDHk83u97R3ji7A== X-Received: by 2002:a05:6512:131e:b0:533:4689:9750 with SMTP id 2adb3069b0e04-5346c626565mr946658e87.26.1724835602114; Wed, 28 Aug 2024 02:00:02 -0700 (PDT) Received: from [1.0.0.7] ([91.185.76.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5334ea36ad8sm2091337e87.118.2024.08.28.02.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Aug 2024 02:00:01 -0700 (PDT) Message-ID: <04adb164-6df3-51c2-edf9-909a1e977976@gmail.com> Date: Wed, 28 Aug 2024 12:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Streaming read-ready sequential scan code Content-Language: en-US To: Thomas Munro Cc: Melanie Plageman , Andres Freund , David Rowley , Heikki Linnakangas , Pg Hackers References: <20240407221229.upgvhyf2gzflcawi@awork3.anarazel.de> <63a63690-dd92-c809-0b47-af05459e95d1@gmail.com> <7e090ca5-1d3d-b4f3-9060-8ec88f444c6c@gmail.com> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 28.08.2024 07:45, Thomas Munro wrote: > Huh. I can reproduce what I showed with pretty low variance, on my > FreeBSD, Linux and macOS systems. I included > parallel_leader_participation=off so that the workers would hopefully > start as closely together in time as possible, and hopefully allow > only a block or so of variation in the outcome. If I do: > > create or replace function f(i int) returns int language plpgsql > parallel safe as $$ > begin > raise notice '% pid %', clock_timestamp(), pg_backend_pid(); > return i; > end; > $$; > > then > > postgres=# explain (analyze) select f(i) from t limit 1; > NOTICE: 2024-08-28 16:41:32.845747+12 pid 47019 > NOTICE: 2024-08-28 16:41:32.845746+12 pid 47018 > > shows start times differ by only a few microseconds at most, often 0. > I wonder if your system is more variable at beginning execution? > Maybe you're on a multi-socket system and forking/startup times vary > in some way I can't see on small systems or something like that? I use a single-socket system with AMD Ryzen 5900X, running Ubuntu 20.04. With no active background tasks running, I'm seeing: NOTICE:  2024-08-28 08:17:36.917162+00 pid 320103 NOTICE:  2024-08-28 08:17:36.917163+00 pid 320102 NOTICE:  2024-08-28 08:17:40.592333+00 pid 320143 NOTICE:  2024-08-28 08:17:40.592645+00 pid 320144 With log_min_messages = DEBUG3, I get: NOTICE:  2024-08-28 08:41:59.309364+00 pid 338263 NOTICE:  2024-08-28 08:41:59.310079+00 pid 338264 And the following messages in the server.log: 2024-08-28 08:41:59.304 UTC [338251] DEBUG:  starting background worker process "parallel worker for PID 338262" 2024-08-28 08:41:59.304 UTC [338251] DEBUG:  starting background worker process "parallel worker for PID 338262" 2024-08-28 08:41:59.305 UTC [338263] DEBUG:  InitPostgres 2024-08-28 08:41:59.305 UTC [338264] DEBUG:  InitPostgres 2024-08-28 08:41:59.309 UTC [338263] NOTICE:  2024-08-28 08:41:59.309364+00 pid 338263 2024-08-28 08:41:59.309 UTC [338263] CONTEXT:  PL/pgSQL function f(integer) line 3 at RAISE 2024-08-28 08:41:59.309 UTC [338262] NOTICE:  2024-08-28 08:41:59.309364+00 pid 338263 2024-08-28 08:41:59.309 UTC [338262] CONTEXT:  PL/pgSQL function f(integer) line 3 at RAISE     parallel worker 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  shmem_exit(0): 5 before_shmem_exit callbacks to make 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  shmem_exit(0): 6 on_shmem_exit callbacks to make 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  proc_exit(0): 1 callbacks to make 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  exit(0) 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  shmem_exit(-1): 0 before_shmem_exit callbacks to make 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  shmem_exit(-1): 0 on_shmem_exit callbacks to make 2024-08-28 08:41:59.309 UTC [338263] DEBUG:  proc_exit(-1): 0 callbacks to make 2024-08-28 08:41:59.310 UTC [338264] NOTICE:  2024-08-28 08:41:59.310079+00 pid 338264 2024-08-28 08:41:59.310 UTC [338264] CONTEXT:  PL/pgSQL function f(integer) line 3 at RAISE It looks like the two parallel workers were started simultaneously, but then the second one lagged behind... Best regards, Alexander