PostGIS_DropBBox — 도형으로부터 경계 상자 캐시를 삭제합니다.
geometry PostGIS_DropBBox(geometry geomA);
도형으로부터 경계 상자 캐시를 삭제합니다. 이렇게 하면 도형 용량이 줄어들지만, 경계 상자 기반 쿼리는 느려집니다. 오류가 발생한 경계 상자를 삭제하는 데에도 이 함수를 이용합니다. 경계 상자 캐시에 오류가 발생했다는 숨길 수 없는 증거는, 사용자가 ST_Intersects 및 다른 관계성 쿼리를 실행했을 때 당연히 참을 반환해야 할 도형들을 배제하는 경우입니다.
![]() | |
Bounding boxes are automatically added to geometries and improve speed of queries so in general this is not needed unless the generated bounding box somehow becomes corrupted or you have an old install that is lacking bounding boxes. Then you need to drop the old and readd. This kind of corruption has been observed in 8.3-8.3.6 series whereby cached bboxes were not always recalculated when a geometry changed and upgrading to a newer version without a dump reload will not correct already corrupted boxes. So one can manually correct using below and readd the bbox or do a dump reload. |
This method supports Circular Strings and Curves.
--This example drops bounding boxes where the cached box is not correct
--The force to ST_AsBinary before applying Box2D forces a recalculation of the box, and Box2D applied to the table geometry always
-- returns the cached bounding box.
UPDATE sometable
SET geom = PostGIS_DropBBox(geom)
WHERE Not (Box2D(ST_AsBinary(geom)) = Box2D(geom));
UPDATE sometable
SET geom = PostGIS_AddBBox(geom)
WHERE Not PostGIS_HasBBOX(geom);