[postgis-devel] SQL exception occurred when using geometry or geography in a parallel query

LIANGBO 18043625 at cnsuning.com
Thu Jul 4 04:39:10 PDT 2019


Dear All,

When calculating the distance between geometry or geography by the function ST_Distance, I found the following error:
ERROR: cannot update SecondarySnapshot during a parallel operation
CONTEXT: SQL statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1"
Parallel worker

1. Test environment
centOS7.3 x64
PostgreSQL 10.7
PostGIS 2.5.1
RECORDS OF TARGET TABLE:1000000+

2. Execute SQL

```
test=# \d info_test
                       Table "public.info_test"
     Column     |          Type          | Collation | Nullable | Default 
----------------+------------------------+-----------+----------+---------
 id             | bigint                 |           | not null | 
 loc            | geometry               |           |          | 
Indexes:
    "pk_info_test" PRIMARY KEY, btree (id)
    "idx_info_test" gist (loc)
test=# SELECT ST_Distance(loc, ST_SetSRID(ST_Point(118.813933,32.051875),4326), false)::int as distance
FROM info_test
ORDER BY distance limit 10;
ERROR:  cannot update SecondarySnapshot during a parallel operation
CONTEXT:  SQL statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1"
parallel worker
```

3. Investigation
A)By setting the parameter max_parallel_workers and max_parallel_workers_per_gather to 0 and then executing the SQL, SQL can execute normally.
B)We try to reproduce this phenomenon, it only happens occasionally when specific data is available. The probability of occurrence is very low.

I am looking forward for your reply.
 
Best Regards,
LIANGBO


LIANGBO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20190704/de6bab6d/attachment.html>


More information about the postgis-devel mailing list