My use case: I am using ST_3DDifference to calculate the net volume of a dam shape (an extruded triangle) with a terrain source (Delaunay triangles extruded to make a solid).
My query: The following statement runs slowly (nearly 10 minutes for a single row dam / terrain intersection): *SELECT SELECT ST_3DDifference(dp.geom, vp.geom) FROM dam_polysurf dp, valley_polysurf vp WHERE dp.id <http://dp.id> = 1 AND vp.id <http://vp.id> = 1* See Stack Overflow query in link below for details. I have tested a similar statement using the QSFCGAL plugin with "Intersection 3D", which takes a similar length of time as in PostGIS with ST_3dIntersection (ST_3ddifference is not available currently in QSFCGAL). So this suggests that the issue is to do with the underlying SFCGAL code rather than PostGIS. However I have posted this query on https://stackoverflow.com/questions/79456705/st-3ddifference-in-postgis-taking-several-minutes-to-run-on-two-polyhedralsrufac and also emailed one of the tema at Oslandia, but no response. I could not find any insight into how the underlying "ST_3ddifference" algorithm works on the https://sfcgal.gitlab.io/SFCGAL/ website. Now throwing it out to the PostGIS mailing list, in case others have come across with this, or have some ideas to improve it (e.g. how to reduce the number of faces in the valley_polysurf row). Thanks, Neil