From g.smolkin@postgrespro.ru Tue Oct 11 10:02:04 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bttsp-0000K2-JB for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 10:02:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bttso-0008FE-W9 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 10:02:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bttsA-0006nJ-9T for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 10:01:22 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btts5-0004DH-JR for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 10:01:20 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id C83A421C39C5 for ; Tue, 11 Oct 2016 13:01:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mBlC4GVho2TP for ; Tue, 11 Oct 2016 13:01:15 +0300 (MSK) Received: from [192.168.27.190] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 66AE021C36CD for ; Tue, 11 Oct 2016 13:01:15 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1476180075; bh=I+5Olwm1GZTFNxSgFi1XBvK9c49FD/n9ZNbYkKsy0xg=; h=To:From:Subject:Date; b=NgTcSKnZHs2bXh6cyBSFzJLPc85wnqN8K+4X+eOF+muCFr6XtCkaVE7+oqFtw8W63 e8GWEcEyHy+nBoLjSOwGWJaccD7taZQkJUzKsWoI97R4rOafu9zbbiey3QkVc8+g76 4DIG/8QbDV2F/JJBROepv6APv9gfDnKMzJj18TeQ= To: pgsql-bugs@postgresql.org From: Grigory Smolkin Subject: parallel plan in insert query Message-ID: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> Date: Tue, 11 Oct 2016 13:01:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------5D97936B00AEADDA2B309956" X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------5D97936B00AEADDA2B309956 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, everyone! I have a query with following plan: https://gist.github.com/gsmol/a0e752a3f003330a85e2bf243516a2d6 It fails with: ERROR: cannot start commands during a parallel operation I was under impression that for a write query no parallel plan will every be generated. Am I missed something? -- Grigory Smolkin Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------5D97936B00AEADDA2B309956 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hello, everyone!

I have a query with following plan:
https://gist.github.com/gsmol/a0e752a3f003330a85e2bf243516a2d6

It fails with:
ERROR: cannot start commands during a parallel operation

I was under impression that for a write query no parallel plan will every be generated.
Am I missed something?


-- 
Grigory Smolkin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
--------------5D97936B00AEADDA2B309956-- From stark@mit.edu Tue Oct 11 11:42:32 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btvS3-00045q-UO for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 11:42:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btvS3-00029o-AP for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 11:42:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btvS2-00029h-Nf for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 11:42:30 +0000 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1btvRz-0005xr-Fk for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 11:42:29 +0000 Received: by mail-lf0-x229.google.com with SMTP id x79so38163529lff.0 for ; Tue, 11 Oct 2016 04:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wiadkQYt7jguEkCU6h3tfcyHrR66K6sKkpFGxz5gzL4=; b=PuEEKvROGHNhmygbHcWRX0KSTk5xUQ99JXg4SDBbbrxZlAnWuyDgb0WAurVjDaxKm0 fno3lNITdeyTXVHCR3jIh9B9IQBgnTs0g+60/Xjw2xSRZECqvHbMZmCFBoRsJ4Fey4n4 Ova5J98etWFOkflLCWNhZ0W2U0MIVvvZkgAPkbIvZMGlgi7cEKX4SNChUTcgJMH+cxwu 5sSpx/r7jWoV5E1lG5FoMdYcBf5FiNvXRg01Cnl7CcwAvMuiv5sT7X1QYLbLXsA0ECYL NI2wUd9GOY07EZxW9RcBFOq52rDTtQ1kkzFF4/KKigLKrTi2R4KTerZqmaPUF6jWuBXe fMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wiadkQYt7jguEkCU6h3tfcyHrR66K6sKkpFGxz5gzL4=; b=KiqWKEPF7Mv91rEc2dZFmPdt8jeOa5K30QBR1byXf+XbVMNgSu9JXNxyo1jcFNtrTa MJM2m9DXZOhdRyO2yw+UoKYolfmWUTyfuudP0PCKQCX/S20T+537pNxKqJVmK3BOaUiD 43Gcs7+HNypBFrSjVLnCCPQPeP3lPnhR+4AiN6q5/Hv08J2nhe+hA8783sGK2xLYUxMv hgNlZs1OxVj1hhDgrwUmELAiHv8Zi0Ebfm8IgJLtcPkeyn/QIelCuZZ/ohwLeUpTZEFE g+rTlr6MPizU+pZjKiPo55uMym4572dfjz79/vBNBlvrhG3Y8v8ZyWd+p1IGb3WyvJLH I+sA== X-Gm-Message-State: AA6/9Rk9lHnQILXO1tYdvTiY5FptfHN81hJrZu/vSGs6mqwfDZ2kJ2UfATdXs1YJZGd2kCgAlpePJi3+wMmVLw== X-Received: by 10.194.113.201 with SMTP id ja9mr4351159wjb.109.1476186145379; Tue, 11 Oct 2016 04:42:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.26.102 with HTTP; Tue, 11 Oct 2016 04:41:44 -0700 (PDT) In-Reply-To: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> References: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> From: Greg Stark Date: Tue, 11 Oct 2016 12:41:44 +0100 X-Google-Sender-Auth: HJXDu2ofTPfJhX3Nszl1Xt06_iE Message-ID: Subject: Re: parallel plan in insert query To: Grigory Smolkin Cc: PostgreSQL Bugs Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The query doesn't look like a write query from the sql or the plan you sent. My guess is that one of the PostGIS functions does an update or insert internally. It should probably be marked VOLATILE in that case which I'm not sure but would assume would disable parallel queries as well. But there are reasons why they might not want to do that too in which case this is the kind of risk that would come with. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs From g.smolkin@postgrespro.ru Tue Oct 11 11:48:26 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btvXl-0004JK-Sq for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 11:48:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btvXl-00035y-CR for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 11:48:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btvXk-00035s-T8 for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 11:48:25 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btvXh-00064W-Ju for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 11:48:23 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7A60C21C3942 for ; Tue, 11 Oct 2016 14:48:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5DV9VNwF_6D5 for ; Tue, 11 Oct 2016 14:48:19 +0300 (MSK) Received: from [192.168.27.190] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 4E46D21C37E5 for ; Tue, 11 Oct 2016 14:48:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1476186499; bh=5sLcNivRU5riVWbJGOeNLsiLD1X9fYeGRmuw+kLuX7o=; h=Subject:To:References:From:Date:In-Reply-To; b=eMm9HSxmLXZFmudhOR9hwOd5jOEdsIZNCLE/usdzGoWBuncWd2srhGEb+ca7fLyue Yls/XDfve9S/KskFSdl96iIfNzEWOLzVT5uwixuEBm9S6VyH08UkAX/sM3GimsY6OX rHLF81DlWoQeT00zh+XqhRqk4qvRyh5qar6xFWlA= Subject: Re: parallel plan in insert query To: pgsql-bugs@postgresql.org References: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> From: Grigory Smolkin Message-ID: Date: Tue, 11 Oct 2016 14:48:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------328524E22BF040906E896507" X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------328524E22BF040906E896507 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit It`s INSERT: 2016-10-07 19:41:41 MSK [11404]: [78416-1] user=gis,db=gis,app=psql,client=[local] STATEMENT: explain analyze insert into edges_snapped_speeds select gid, speed*3600, ts from (select * from traffic_snapped_tracks limit 2) a join lateral snaptopgr(geom) on true; It does qualify query as 'write query'? On 10/11/2016 02:41 PM, Greg Stark wrote: > The query doesn't look like a write query from the sql or the plan you > sent. My guess is that one of the PostGIS > functions does an update or insert internally. It should probably be > marked VOLATILE in that case which I'm not sure but would assume would > disable parallel queries as well. But there are reasons why they might > not want to do that too in which case this is the kind of risk that > would come with. > > -- Grigory Smolkin Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------328524E22BF040906E896507 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

It`s INSERT:
2016-10-07 19:41:41 MSK [11404]: [78416-1] user=gis,db=gis,app=psql,client=[local] STATEMENT:
explain analyze insert into edges_snapped_speeds select gid, speed*3600, ts from (select * from traffic_snapped_tracks limit 2) a join lateral snaptopgr(geom) on true;

It does qualify query as 'write query'?

On 10/11/2016 02:41 PM, Greg Stark wrote:
The query doesn't look like a write query from the sql or the plan you
sent. My guess is that one of the PostGIS
functions does an update or insert internally. It should probably be
marked VOLATILE in that case which I'm not sure but would assume would
disable parallel queries as well. But there are reasons why they might
not want to do that too in which case this is the kind of risk that
would come with.



-- 
Grigory Smolkin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
--------------328524E22BF040906E896507-- From amit.kapila16@gmail.com Tue Oct 11 12:24:57 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btw77-0005jq-6g for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 12:24:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btw75-0006hu-Lq for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 12:24:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btw74-0006hV-Qr for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 12:24:55 +0000 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1btw6x-0006iS-0g for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 12:24:53 +0000 Received: by mail-lf0-x232.google.com with SMTP id l131so6391732lfl.2 for ; Tue, 11 Oct 2016 05:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=a0go+Vrct3Zccxbql09Qi/w9NH1zB71EFPA9eyjROqM=; b=Q/WhirtMgEHPS6OSutrrGIoBav5XTBsm4VoS9loyInxIGIieE3ksyXMuuMvSNQEM/9 6AiJYes8vZWy9j9JngxNFh7Hdd+33QmUtsW/5wvBDlvp7CjJSBKsS6LXgYe1dvI8IuPQ pI/OCz9Cw7Yjy1Wse7WJGf4jEtPcBK/U1vsPYDuPc06Fc+sTC5cfXZhlggXSv+0Kwggd ep8oCrVPc/maT5rqBbNDR5RfWuh3rBzDzhlZWE1VAq8mQ+2goIukVkTd3HYxWa+TG+sF 93nw+Y0QdXS8JVnVorbSL65wuV7/gylfE+6Wt+p7L2Qm8+8eZUVgZosxm9GZIwM3oo9g VaBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=a0go+Vrct3Zccxbql09Qi/w9NH1zB71EFPA9eyjROqM=; b=XDWhRRYitWmeXjAsdyxdhLQojeEv4XEoJHN59vVOqDwakR40pMQI2O6Ao5I32dplgc ExhSJHE59jlODTO/zrcy1kqbJdkUbklmnTmXyFsuBbAS3gIttrS15zjobvwd0uUbb5Hq HQfXszFVibkbV6gF7OeZQWnhN5lZtOshdcKsgc/ESR2ZOAaq8Ww3MqUlI0rwgL7Bzd1m EbLJEn5Rxq8ZpFv1rZck1rpdwNUm/m8WnLliG5KiY14U7Bzt0bBianQ+8yAtKvaRhwyV +ZLM6Ju0VOOJE1DgGq6BPDFpZFhkOkgGWarRZOoN5Z4cuouIeW8T/Jel15XyuGtR2bmY PPww== X-Gm-Message-State: AA6/9RmZPMVcIRldzUU7Yvq2+sNAx6EdGK+fK0IBScrgX+upUHrX+gZRWOLoikILpzXYeGK1o7MPhatlTFDiOQ== X-Received: by 10.194.30.37 with SMTP id p5mr4490435wjh.44.1476188684862; Tue, 11 Oct 2016 05:24:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.50.69 with HTTP; Tue, 11 Oct 2016 05:24:41 -0700 (PDT) In-Reply-To: References: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> From: Amit Kapila Date: Tue, 11 Oct 2016 17:54:41 +0530 Message-ID: Subject: Re: parallel plan in insert query To: Grigory Smolkin Cc: PostgreSQL Bugs Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Tue, Oct 11, 2016 at 5:18 PM, Grigory Smolkin wrote: > It`s INSERT: > 2016-10-07 19:41:41 MSK [11404]: [78416-1] > user=gis,db=gis,app=psql,client=[local] STATEMENT: > explain analyze insert into edges_snapped_speeds select gid, speed*3600, ts > from (select * from traffic_snapped_tracks limit 2) a join lateral > snaptopgr(geom) on true; > > It does qualify query as 'write query'? > That's right, but parallelism can be used read part of query. For example, insert into t1 select * from parallel_exec(); Now if there is some statement in parallel_exec() function, that can use parallelism. Example function definition which can use parallelism: create or replace function parallel_exec() returns integer as $$ begin Perform * from t1 where c1 >= 10 and c1 < 11; return 1; end; $$ language plpgsql STABLE PARALLEL SAFE; -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs From tgl@sss.pgh.pa.us Tue Oct 11 13:01:01 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btwg1-0007GY-7Y for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 13:01:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btwg0-0004BO-Qc for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 13:01:00 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btwfz-00048h-Vd for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 13:01:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btwfw-00018I-Ft for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 13:00:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9BD0qsS021110; Tue, 11 Oct 2016 09:00:52 -0400 From: Tom Lane To: Grigory Smolkin cc: pgsql-bugs@postgresql.org Subject: Re: parallel plan in insert query In-reply-to: References: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> Comments: In-reply-to Grigory Smolkin message dated "Tue, 11 Oct 2016 14:48:19 +0300" Date: Tue, 11 Oct 2016 09:00:52 -0400 Message-ID: <21109.1476190852@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Grigory Smolkin writes: > It`s INSERT: > 2016-10-07 19:41:41 MSK [11404]: [78416-1] > user=gis,db=gis,app=psql,client=[local] STATEMENT: > explain analyze insert into edges_snapped_speeds select gid, speed*3600, > ts from (select * from traffic_snapped_tracks limit 2) a join lateral > snaptopgr(geom) on true; No, it isn't: 2016-10-07 19:41:41 MSK [11404]: [78414-1] user=gis,db=gis,app=psql,client=[local] ERROR: cannot start commands during a parallel operation 2016-10-07 19:41:41 MSK [11404]: [78415-1] user=gis,db=gis,app=psql,client=[local] CONTEXT: SQL statement "SELECT proj4text FROM spatial_ref_sys WHERE srid = 4326 LIMIT 1" 2016-10-07 19:41:41 MSK [11404]: [78416-1] user=gis,db=gis,app=psql,client=[local] STATEMENT: explain analyze insert into edges_snapped_speeds select gid, speed*3600, ts from (select * from traffic_snapped_tracks limit 2) a join lateral snaptopgr(geom) on true; This is somewhere down inside a SELECT issued by a called function. Apparently you've got multiple levels of nested SQL operations there. The outer INSERT wouldn't get parallelized, but a query planned and executed inside a called function could be. I concur with Greg's conclusion that somewhere in the stack there's a function marked PARALLEL SAFE that shouldn't be marked that way. But we don't have nearly enough details to identify it. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs From g.smolkin@postgrespro.ru Tue Oct 11 14:08:11 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxj1-0001WD-31 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 14:08:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btxj0-0000iw-GT for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 14:08:10 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btxj0-0000iq-5j for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 14:08:10 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxiw-0002K9-W1 for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 14:08:09 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id BAD2721C3989 for ; Tue, 11 Oct 2016 17:08:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nN6t5pLxh8XP for ; Tue, 11 Oct 2016 17:08:05 +0300 (MSK) Received: from [192.168.27.190] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 8F8F121C3968 for ; Tue, 11 Oct 2016 17:08:05 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1476194885; bh=EyiTR6WPXmCyFtHiWnXDGVgKMHm+Y60f32LBfjSNxdc=; h=Subject:To:References:From:Date:In-Reply-To; b=ZTkPsIqGigbs6wjW1fCSeAVNYjeLH4GHz46O0lU6oceZBQFFXK3eaoFfrXkupZPKl aB35QRbt4ORarv905wAHsgOnS7e8fq6lj6bQjByMKxWHpcLOeBL1WG5IQZ1d+Wdp+Z aqd+i6n9gm3hh8ywEKNtXD6s0d0M96xvjaflDDog= Subject: Re: parallel plan in insert query To: pgsql-bugs@postgresql.org References: <2950428a-2b07-03cb-4ec0-7454853fe244@postgrespro.ru> <21109.1476190852@sss.pgh.pa.us> From: Grigory Smolkin Message-ID: <8bcf26dc-2556-f3aa-b524-30cd0809a3a0@postgrespro.ru> Date: Tue, 11 Oct 2016 17:08:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <21109.1476190852@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------2F7B1D0DBC3997516FE3F033" X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------2F7B1D0DBC3997516FE3F033 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Thanks all of you for help! Your answers helped me to better understand a problem. -- Grigory Smolkin Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------2F7B1D0DBC3997516FE3F033 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 7bit Thanks all of you for help!
Your answers helped me to better understand a problem.
-- 
Grigory Smolkin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
--------------2F7B1D0DBC3997516FE3F033--