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 1tcTXq-000MKM-Lj for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2025 18:09: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 1tcTXp-00DudQ-9w for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2025 18:09:09 +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 1tcTXo-00Dud6-WB for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2025 18:09:09 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tcTXl-001pJQ-33 for pgsql-general@postgresql.org; Mon, 27 Jan 2025 18:09:08 +0000 Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-844e39439abso120804839f.1 for ; Mon, 27 Jan 2025 10:09:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilm.com; s=google; t=1738001344; x=1738606144; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=TaTgzIqGenKA/dwtEED2IXrH5bO6EU0zlMHi1/yzVgQ=; b=PuI5vVC72yEfad/6UA+ggCc5qQAtpNEvliWfHMLve54KH4sAUTxp6DaC8rNWqTJq6y ygEJzpdRYxPQadvnUIy0K8qcbFXIoBGawW+kHXF+ijPKhJUmeS1UEWgeg5BCLXSYjzOu oO6LR9thWJiBZWpSdEWk+ZJJGWUq12XddJnDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738001344; x=1738606144; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TaTgzIqGenKA/dwtEED2IXrH5bO6EU0zlMHi1/yzVgQ=; b=uP+kjFhfVN3svUrp8ANR7LVQNScbduM6QbCcF184V8T539noRg3IzzRtJbIY4u/fOb 22rSsS+W8DCMT5NI0m3GK8PTWiwCq0f7lLR37thL8ysIMY/sU7OaaA0RqsY8tnVuGsd8 MpoJzHU818w+CdlsPRGGhgCww1U0lUEydVALMqORYrYMZOga8+i+PpOa0E4aM0QawR7I 1Sp+jegrXx9Zj7HZPG2CKuhox7M4J8D3zgD/bIKUZZht7A+mY5aJNmA+qY+Euv3kOOzx dtB7aTo9YAOcyvia4DGXTaMJDnCNOFvDiEsJWwKMaG9UzLYNzQdumFWFCA5vOVkoewgu +oaQ== X-Gm-Message-State: AOJu0YxyGo1/qduIk75tFIgU3kmYVyeNvYLC9GhYf9Ee6E4yUeEb+sJf 1U4RApzlvdDjOTnOn6g7cl+nvHcCrdGvBcKM/vn7lHT4EqQYTneURXLXcoYzXFx2l2TUqUzPDz9 s5csifcHf+qCP+TOZWq6KmfkNtGjipnxqw1Sy+LMVmUJldUjz X-Gm-Gg: ASbGncvGUL6UhLCPi70nvLaAA5IJ6fSpLxxDgFL2CUZu0yD48EK39Nc9bnk3Uh0CA+t OronOvdFVUfoN9/Yd8r1vt7jfYVt9M1UrRCuPpi+ewtdTKvX0ZFKYzxS5+AYu73Y= X-Google-Smtp-Source: AGHT+IE6Yxcn3gIYu2y09mmtkzLyayoTN04TsofeqAfLG6D+f2U9R3pQcx1dwcuRcRgWNFo63MHh9ckKJ3LwWvr6IjQ= X-Received: by 2002:a05:6602:15cf:b0:847:51e2:eac with SMTP id ca18e2360f4ac-851b61d2096mr3443626439f.7.1738001344345; Mon, 27 Jan 2025 10:09:04 -0800 (PST) MIME-Version: 1.0 From: Jim Vanns Date: Mon, 27 Jan 2025 18:08:53 +0000 X-Gm-Features: AWEUYZl3a_tUpiginX5V2YKNTaAAJ9u3OTE_tjHadYL8K7EdQCwwzprWwp1eudc Message-ID: Subject: Parallel workers via functions? To: pgsql-general Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Apologies for the rushed question ... If I have a function that is marked 'stable parallel safe' and returns a table, can a calling function or procedure (marked volatile parallel unsafe) still take advantage of the parallel workers from the first function - as the data source. I.e. func_a(); // selects, returns table, parallel safe func_b() { insert into foo select * from func_a(); // Will func_a still execute parallel workers to fetch the data? } Or even if func_b() uses 'create temporary table as select * from func_a()' and then insert? I ask because when I simply call func_a() from a psql shell, I see the parallel workers run and everything is nice and swift. But when called from a data-modifying function like func_b(), no workers are spawned :( Even from the read-part of the code. Are there differences in functions vs. stored procedures that might affect the behaviour of the planner to disregard workers? Cheers Jim -- Jim Vanns Principal Production Engineer Industrial Light & Magic, London