Re: parallel plan in insert query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Grigory Smolkin <g(dot)smolkin(at)postgrespro(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: parallel plan in insert query
Date: 2016-10-11 13:00:52
Message-ID: 21109.1476190852@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Grigory Smolkin <g(dot)smolkin(at)postgrespro(dot)ru> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-10-11 13:07:45 Re: Sudden FTS-related error from parallel worker in 9.6
Previous Message Amit Kapila 2016-10-11 12:58:50 Re: Sudden FTS-related error from parallel worker in 9.6