This topic describes the ST_Subdivide function. This function divides the input geometry object into parts until the number of vertexes in each part is less than the value of the maxVertices parameter.


setof  geometry ST_Subdivide(geometry  geom , integer  maxVertices);


Parameter Description
geom The geometry object that you want to specify.
maxVertices The maximum number of vertexes. Default value: 256. Minimum value: 5.


After the division, operations of obtaining points within a polygon object and spatial operations run fast for the indexed divided parts for the following reasons:
  • In most cases, the bounding boxes of all parts are smaller than the box of the input geometry object, so missed points are obtained faster.
  • The recheck operations are performed on fewer points, so hit points are obtained faster.


Execute the following statement to divide a circle object:
SELECT ST_Subdivide(st_buffer('POINT(0 0)'::geometry,1),6);