Opened 10 years ago
Closed 10 years ago
#5427 closed enhancement (fixed)
PostGIS: use ST_EstimatedExtent instead of ST_Extent when possible
Reported by: | gabrimonfa | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.0 |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
In PostGIS driver function GetExtent uses PostGIS function ST_Extent function.
When bForce is false it may be worth to attempt to use ST_EstimatedExtent that is much quicker and returns an extimated extent based on table metadata.
Some notes
- as of now ST_Extent support more data type than ST_EstimatedExtent
- the name has changed between PostGIS 2.0.x (ST_Estimated_Extent) and PostGIS 2.1 (ST_EstimatedExtent)
- In case of empty table or no statistics ST_EstimatedExtent returns NULL (PostGIS version >=1.5.4) or an exception. In this case we can fallback on ST_Extent
A very rough patch, to be reworked and tested, is provided
Attachments (1)
Change History (3)
by , 10 years ago
Attachment: | rough_patch_ST_EstimatedExtent.diff added |
---|
comment:1 by , 10 years ago
Summary: | PostGIS use ST_EstimatedExtent → PostGIS: use ST_EstimatedExtent instead of ST_Extent when possible |
---|
comment:2 by , 10 years ago
Milestone: | → 1.11.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
There were several issues in your patch. The main one being that estimated_extent syntax is "select estimated_extent('schema_name', 'table_name', 'geometry_name)'" (without any from clause).
Hopefully fixed by :
trunk r27106 "PG: use ST_Estimated_Extent() on table layers if GetExtent() is called with force = 0 (derived from patch by gabrimonfa, #5427)"
Rough patch to attempt to use ST_EstimatedExtent (to be reworked)