[postgis-devel] ST_Subdivide Defaults

Paul Ramsey pramsey at cleverelephant.ca
Fri Jan 21 10:05:13 PST 2022


Well, since past me already did this (though ineffectively, I just empirically confirmed we're still getting 256 point outputs), I'm going to do it again, only using 96, which I've just roughly empirically tested out as slightly better than both 128 and 64. And document it!

P

> On Jan 21, 2022, at 9:45 AM, Paul Ramsey <pramsey at cleverelephant.ca> wrote:
> 
> Jokes on me then, the default in the SQL file is still 256.
> 
> CREATE OR REPLACE FUNCTION ST_Subdivide(geom geometry, maxvertices integer DEFAULT 256, gridSize float8 DEFAULT -1.0)
> 
> P.
> 
>> On Jan 21, 2022, at 9:42 AM, Darafei Komяpa Praliaskouski <me at komzpa.net> wrote:
>> 
>> You did that some years ago and ignored my note to update docs: https://github.com/postgis/postgis/commit/feac7c6ed625bea34de847605a590abdb627bd13
>> 
>> пт, 21 сту 2022, 20:35 карыстальнік Paul Ramsey <pramsey at cleverelephant.ca> напісаў:
>> A user was talking about how much faster ST_Subdivide made their query, and their example was materializing the subdivided geometries into a table, building an index, and then using that downstream.
>> 
>> Here's the thing: the default numVertices of ST_Subdivide is 256. Which (256 * 2 * 8 = 4096) is half of a full page, but actually kind of close to the TOAST threshold. At a minimum with standard storage defaults, it'll be getting compressed inline, if not actually TOASTed still. Which will hurt performance.
>> 
>> I was thinking that a 128 or even 96 point default might make a lot more sense. At 128 vertices (2048 bytes) we're still flirting with inline compression, so maybe 96 (1536b) or even 64 vertices (1024b) would be best.
>> 
>> In general, it seems like a missed upportunity to have something shredding down geometries but still be over-running the TOAST thresholds, that we know have performance implications, when the whole point of the shredding is improved performance.
>> 
>> Thoughts?
>> 
>> P
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-devel
> 



More information about the postgis-devel mailing list