From 3ddc11483b2266d3a914ecfdeb3e2a343e0f6dd4 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Fri, 8 Mar 2019 21:48:08 +0000 Subject: [PATCH] Add costs to functions in the form of macros: _COST_LOW, _COST_MEDIUM, _COST_HIGH Macros are set in sqldefines.h.in and are switched on PgSQL version. Prior to PG12, costs should be small or nonexistent, to avoid SQL inlining issues. After Pg12, costs can be higher to hopefully force more parallelism in plans. Closes #4344 git-svn-id: http://svn.osgeo.org/postgis/trunk@17307 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/geography.sql.in | 104 +++-- postgis/postgis.sql.in | 948 ++++++++++++++++++++++----------------- postgis/sqldefines.h.in | 19 + 3 files changed, 611 insertions(+), 460 deletions(-) diff --git a/postgis/geography.sql.in b/postgis/geography.sql.in index 56760634b..8a7b9567c 100644 --- a/postgis/geography.sql.in +++ b/postgis/geography.sql.in @@ -102,13 +102,15 @@ CREATE CAST (geography AS bytea) WITH FUNCTION bytea(geography) AS IMPLICIT; CREATE OR REPLACE FUNCTION ST_AsText(geography) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asText' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_AsText(geography, int4) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asText' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_AsText(text) @@ -120,19 +122,22 @@ CREATE OR REPLACE FUNCTION ST_AsText(text) CREATE OR REPLACE FUNCTION ST_GeographyFromText(text) RETURNS geography AS 'MODULE_PATHNAME','geography_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GeogFromText(text) RETURNS geography AS 'MODULE_PATHNAME','geography_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GeogFromWKB(bytea) RETURNS geography AS 'MODULE_PATHNAME','geography_from_binary' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION postgis_typmod_dims(integer) @@ -401,7 +406,8 @@ CREATE OPERATOR CLASS btree_geography_ops CREATE OR REPLACE FUNCTION ST_AsSVG(geog geography, rel int4 DEFAULT 0, maxdecimaldigits int4 DEFAULT 15) RETURNS text AS 'MODULE_PATHNAME','geography_as_svg' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_AsSVG(text) @@ -421,12 +427,14 @@ CREATE OR REPLACE FUNCTION ST_AsSVG(text) CREATE OR REPLACE FUNCTION ST_AsGML(version int4, geog geography, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0, nprefix text DEFAULT 'gml', id text DEFAULT '') RETURNS text AS 'MODULE_PATHNAME','geography_as_gml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION ST_AsGML(geog geography, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0, nprefix text DEFAULT 'gml', id text DEFAULT '') RETURNS text AS 'MODULE_PATHNAME','geography_as_gml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography -- Change 2.0.0 to use base function @@ -444,7 +452,8 @@ CREATE OR REPLACE FUNCTION ST_AsGML(text) CREATE OR REPLACE FUNCTION ST_AsKML(geog geography, maxdecimaldigits int4 DEFAULT 15, nprefix text DEFAULT '') RETURNS text AS 'MODULE_PATHNAME','geography_as_kml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography -- Deprecated 2.0.0 @@ -460,7 +469,8 @@ CREATE OR REPLACE FUNCTION ST_AsKML(text) CREATE OR REPLACE FUNCTION ST_AsGeoJson(geog geography, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0) RETURNS text AS 'MODULE_PATHNAME','geography_as_geojson' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography -- Deprecated in 2.0.0 @@ -475,12 +485,11 @@ CREATE OR REPLACE FUNCTION ST_AsGeoJson(text) -- Availability: 1.5.0 -- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - CREATE OR REPLACE FUNCTION ST_Distance(geog1 geography, geog2 geography, use_spheroid boolean DEFAULT true) RETURNS float8 AS 'MODULE_PATHNAME','geography_distance' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_Distance(text, text) @@ -494,8 +503,7 @@ CREATE OR REPLACE FUNCTION _ST_Expand(geography, float8) RETURNS geography AS 'MODULE_PATHNAME','geography_expand' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 50; - + _COST_LOW; -- ---------- ---------- ---------- ---------- ---------- ---------- ---------- @@ -508,7 +516,7 @@ CREATE OR REPLACE FUNCTION _ST_DistanceUnCached(geography, geography, float8, bo RETURNS float8 AS 'MODULE_PATHNAME','geography_distance_uncached' LANGUAGE 'c' IMMUTABLE STRICT - COST 100; + _COST_HIGH; -- Calculate the distance in geographics *without* using the caching code line or tree code CREATE OR REPLACE FUNCTION _ST_DistanceUnCached(geography, geography, boolean) @@ -528,7 +536,7 @@ CREATE OR REPLACE FUNCTION _ST_DistanceTree(geography, geography, float8, boolea RETURNS float8 AS 'MODULE_PATHNAME','geography_distance_tree' LANGUAGE 'c' IMMUTABLE STRICT - COST 100; + _COST_HIGH; -- Calculate the distance in geographics using the circular tree code, but -- *without* using the caching code line @@ -542,7 +550,7 @@ CREATE OR REPLACE FUNCTION _ST_DWithinUnCached(geography, geography, float8, boo RETURNS boolean AS 'MODULE_PATHNAME','geography_dwithin_uncached' LANGUAGE 'c' IMMUTABLE STRICT - COST 100; + _COST_HIGH; -- Calculate the dwithin relation *without* using the caching code line or tree code CREATE OR REPLACE FUNCTION _ST_DWithinUnCached(geography, geography, float8) @@ -557,7 +565,7 @@ CREATE OR REPLACE FUNCTION ST_Area(geog geography, use_spheroid boolean DEFAULT RETURNS float8 AS 'MODULE_PATHNAME','geography_area' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_Area(text) @@ -570,7 +578,7 @@ CREATE OR REPLACE FUNCTION ST_Length(geog geography, use_spheroid boolean DEFAUL RETURNS float8 AS 'MODULE_PATHNAME','geography_length' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_Length(text) @@ -583,46 +591,49 @@ CREATE OR REPLACE FUNCTION ST_Project(geog geography, distance float8, azimuth f RETURNS geography AS 'MODULE_PATHNAME','geography_project' LANGUAGE 'c' IMMUTABLE _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_Azimuth(geog1 geography, geog2 geography) RETURNS float8 AS 'MODULE_PATHNAME','geography_azimuth' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_Perimeter(geog geography, use_spheroid boolean DEFAULT true) RETURNS float8 AS 'MODULE_PATHNAME','geography_perimeter' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION _ST_PointOutside(geography) RETURNS geography AS 'MODULE_PATHNAME','geography_point_outside' - LANGUAGE 'c' IMMUTABLE STRICT; + LANGUAGE 'c' IMMUTABLE STRICT + _COST_MEDIUM; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Segmentize(geog geography, max_segment_length float8) RETURNS geography AS 'MODULE_PATHNAME','geography_segmentize' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION _ST_BestSRID(geography, geography) RETURNS integer AS 'MODULE_PATHNAME','geography_bestsrid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION _ST_BestSRID(geography) RETURNS integer AS 'MODULE_PATHNAME','geography_bestsrid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_Buffer(geography, float8) @@ -670,25 +681,29 @@ CREATE OR REPLACE FUNCTION ST_Intersection(geography, geography) CREATE OR REPLACE FUNCTION ST_Intersection(text, text) RETURNS geometry AS $$ SELECT @extschema@.ST_Intersection($1::@extschema@.geometry, $2::@extschema@.geometry); $$ - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_AsBinary(geography) RETURNS bytea AS 'MODULE_PATHNAME','LWGEOM_asBinary' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_AsBinary(geography, text) RETURNS bytea AS 'MODULE_PATHNAME','LWGEOM_asBinary' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_AsEWKT(geography) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asEWKT' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.0.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography CREATE OR REPLACE FUNCTION ST_AsEWKT(text) @@ -706,31 +721,36 @@ CREATE OR REPLACE FUNCTION GeometryType(geography) CREATE OR REPLACE FUNCTION ST_Summary(geography) RETURNS text AS 'MODULE_PATHNAME', 'LWGEOM_summary' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_GeoHash(geog geography, maxchars int4 DEFAULT 0) RETURNS TEXT AS 'MODULE_PATHNAME', 'ST_GeoHash' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_SRID(geog geography) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_get_srid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_SetSRID(geog geography, srid int4) RETURNS geography AS 'MODULE_PATHNAME', 'LWGEOM_set_srid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_Centroid(geography, use_spheroid boolean DEFAULT true) RETURNS geography AS 'MODULE_PATHNAME','geography_centroid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography @@ -747,7 +767,7 @@ CREATE OR REPLACE FUNCTION _ST_Covers(geog1 geography, geog2 geography) RETURNS boolean AS 'MODULE_PATHNAME','geography_covers' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Stop calculation and return immediately once distance is less than tolerance -- Availability: 1.5.0 @@ -755,7 +775,7 @@ CREATE OR REPLACE FUNCTION _ST_DWithin(geog1 geography, geog2 geography, toleran RETURNS boolean AS 'MODULE_PATHNAME','geography_dwithin' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Only implemented for polygon-over-point -- Availability: 3.0.0 @@ -763,7 +783,7 @@ CREATE OR REPLACE FUNCTION _ST_CoveredBy(geog1 geography, geog2 geography) RETURNS boolean AS 'MODULE_PATHNAME','geography_coveredby' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; #if POSTGIS_PGSQL_VERSION >= 120 @@ -773,7 +793,7 @@ CREATE OR REPLACE FUNCTION ST_Covers(geog1 geography, geog2 geography) AS 'MODULE_PATHNAME','geography_covers' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_DWithin(geog1 geography, geog2 geography, tolerance float8, use_spheroid boolean DEFAULT true) @@ -781,7 +801,7 @@ CREATE OR REPLACE FUNCTION ST_DWithin(geog1 geography, geog2 geography, toleranc AS 'MODULE_PATHNAME','geography_dwithin' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 3.0.0 CREATE OR REPLACE FUNCTION ST_CoveredBy(geog1 geography, geog2 geography) @@ -789,7 +809,7 @@ CREATE OR REPLACE FUNCTION ST_CoveredBy(geog1 geography, geog2 geography) AS 'MODULE_PATHNAME','geography_coveredby' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_Intersects(geog1 geography, geog2 geography) @@ -797,7 +817,7 @@ CREATE OR REPLACE FUNCTION ST_Intersects(geog1 geography, geog2 geography) AS 'MODULE_PATHNAME','geography_intersects' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; #else diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index cc749de26..d3187de8f 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -61,8 +61,7 @@ BEGIN RAISE DEBUG '% signature was deprecated in %. Please use %', oldname, version, newname; END IF; END; -$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT - COST 100; +$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT _COST_MEDIUM; ------------------------------------------------------------------- -- SPHEROID TYPE @@ -201,26 +200,29 @@ CREATE CAST (polygon AS geometry) WITH FUNCTION geometry(polygon); CREATE OR REPLACE FUNCTION ST_X(geometry) RETURNS float8 AS 'MODULE_PATHNAME','LWGEOM_x_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT + _PARALLEL _COST_DEFAULT; -- PostGIS equivalent function: Y(geometry) CREATE OR REPLACE FUNCTION ST_Y(geometry) RETURNS float8 AS 'MODULE_PATHNAME','LWGEOM_y_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT + _PARALLEL _COST_DEFAULT; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Z(geometry) RETURNS float8 AS 'MODULE_PATHNAME','LWGEOM_z_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT + _PARALLEL _COST_DEFAULT; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_M(geometry) RETURNS float8 AS 'MODULE_PATHNAME','LWGEOM_m_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; - + LANGUAGE 'c' IMMUTABLE STRICT + _PARALLEL _COST_DEFAULT; ------------------------------------------------------------------- @@ -1014,12 +1016,12 @@ CREATE OR REPLACE FUNCTION ST_MakeBox2d(geom1 geometry, geom2 geometry) -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_EstimatedExtent(text,text,text,boolean) RETURNS box2d AS 'MODULE_PATHNAME', 'gserialized_estimated_extent' - LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER; + LANGUAGE 'c' STABLE STRICT SECURITY DEFINER; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_EstimatedExtent(text,text,text) RETURNS box2d AS 'MODULE_PATHNAME', 'gserialized_estimated_extent' - LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER; + LANGUAGE 'c' STABLE STRICT SECURITY DEFINER; ----------------------------------------------------------------------- -- ST_ESTIMATED_EXTENT( , ) @@ -1028,7 +1030,7 @@ CREATE OR REPLACE FUNCTION ST_EstimatedExtent(text,text,text) RETURNS box2d AS -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_EstimatedExtent(text,text) RETURNS box2d AS 'MODULE_PATHNAME', 'gserialized_estimated_extent' - LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER; + LANGUAGE 'c' STABLE STRICT SECURITY DEFINER; ----------------------------------------------------------------------- -- FIND_EXTENT( ,
, ) @@ -1048,7 +1050,7 @@ BEGIN END LOOP; END; $$ -LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; +LANGUAGE 'plpgsql' STABLE STRICT _PARALLEL; ----------------------------------------------------------------------- -- FIND_EXTENT(
, ) @@ -1068,7 +1070,7 @@ BEGIN END LOOP; END; $$ -LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; +LANGUAGE 'plpgsql' STABLE STRICT _PARALLEL; ------------------------------------------- @@ -1097,7 +1099,7 @@ CREATE OR REPLACE FUNCTION ST_QuantizeCoordinates(g geometry, prec_x int, prec_y RETURNS geometry AS 'MODULE_PATHNAME', 'ST_QuantizeCoordinates' LANGUAGE 'c' IMMUTABLE _PARALLEL - COST 10; + _COST_MEDIUM; ------------------------------------------------------------------------ -- DEBUG @@ -1108,27 +1110,28 @@ CREATE OR REPLACE FUNCTION ST_MemSize(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_mem_size' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Summary(geometry) RETURNS text AS 'MODULE_PATHNAME', 'LWGEOM_summary' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_NPoints(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_npoints' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_NRings(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_nrings' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; ------------------------------------------------------------------------ -- Measures @@ -1138,56 +1141,56 @@ CREATE OR REPLACE FUNCTION ST_3DLength(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_length_linestring' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 20; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Length2d(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_length2d_linestring' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: length2d(geometry) CREATE OR REPLACE FUNCTION ST_Length(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_length2d_linestring' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability in 2.2.0 CREATE OR REPLACE FUNCTION ST_LengthSpheroid(geometry, spheroid) RETURNS FLOAT8 AS 'MODULE_PATHNAME','LWGEOM_length_ellipsoid_linestring' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 500; + _COST_MEDIUM; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_Length2DSpheroid(geometry, spheroid) RETURNS FLOAT8 AS 'MODULE_PATHNAME','LWGEOM_length2d_ellipsoid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 500; + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_3DPerimeter(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_perimeter_poly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_perimeter2d(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_perimeter2d_poly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: perimeter2d(geometry) CREATE OR REPLACE FUNCTION ST_Perimeter(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'LWGEOM_perimeter2d_poly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 1.2.2 -- Deprecation in 1.3.4 @@ -1195,72 +1198,77 @@ CREATE OR REPLACE FUNCTION ST_Area2D(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'ST_Area' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: area(geometry) CREATE OR REPLACE FUNCTION ST_Area(geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME','ST_Area' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_IsPolygonCW(geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_IsPolygonCW' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_IsPolygonCCW(geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_IsPolygonCCW' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_DistanceSpheroid(geom1 geometry, geom2 geometry,spheroid) RETURNS FLOAT8 AS 'MODULE_PATHNAME','LWGEOM_distance_ellipsoid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 200; --upped this + _COST_MEDIUM; --upped this -- Minimum distance. 2D only. CREATE OR REPLACE FUNCTION ST_Distance(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_Distance' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; --changed from 100 should be 1/5th to 1/10 spheroid + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_PointInsideCircle(geometry,float8,float8,float8) RETURNS bool AS 'MODULE_PATHNAME', 'LWGEOM_inside_circle_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_azimuth(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'LWGEOM_azimuth' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_Angle(pt1 geometry, pt2 geometry, pt3 geometry, pt4 geometry default 'POINT EMPTY'::geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'LWGEOM_angle' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: Future -- CREATE OR REPLACE FUNCTION _ST_DistanceRectTree(g1 geometry, g2 geometry) -- RETURNS float8 -- AS 'MODULE_PATHNAME', 'ST_DistanceRectTree' --- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; +-- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL +-- _COST_MEDIUM; -- Availability: Future -- CREATE OR REPLACE FUNCTION _ST_DistanceRectTreeCached(g1 geometry, g2 geometry) -- RETURNS float8 -- AS 'MODULE_PATHNAME', 'ST_DistanceRectTreeCached' --- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; +-- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL +-- _COST_MEDIUM; ------------------------------------------------------------------------ -- MISC @@ -1271,267 +1279,279 @@ CREATE OR REPLACE FUNCTION ST_Force2D(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_2d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Force3DZ(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_3dz' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Force3D(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_3dz' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Force3DM(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_3dm' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_Force4D(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_4d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_ForceCollection(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_collection' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_CollectionExtract(geometry, integer) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_CollectionExtract' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_CollectionHomogenize(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_CollectionHomogenize' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Multi(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_multi' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_ForceCurve(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_curve' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_ForceSFS(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_sfs' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_ForceSFS(geometry, version text) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_sfs' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Expand(box3d,float8) RETURNS box3d AS 'MODULE_PATHNAME', 'BOX3D_expand' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Expand(box box3d, dx float8, dy float8, dz float8 DEFAULT 0) RETURNS box3d AS 'MODULE_PATHNAME', 'BOX3D_expand' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Expand(geometry,float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_expand' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Expand(geom geometry, dx float8, dy float8, dz float8 DEFAULT 0, dm float8 DEFAULT 0) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_expand' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- PostGIS equivalent function: envelope(geometry) CREATE OR REPLACE FUNCTION ST_Envelope(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_envelope' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_BoundingDiagonal(geom geometry, fits boolean DEFAULT false) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_BoundingDiagonal' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Reverse(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_reverse' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_ForcePolygonCW(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_clockwise_poly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 15; + _COST_MEDIUM; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_ForcePolygonCCW(geometry) RETURNS geometry AS $$ SELECT @extschema@.ST_Reverse(@extschema@.ST_ForcePolygonCW($1)) $$ - LANGUAGE SQL IMMUTABLE STRICT _PARALLEL - COST 15; + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_ForceRHR(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_force_clockwise_poly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION postgis_noop(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_noop' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_DEFAULT; -- Availability: 3.0.0 CREATE OR REPLACE FUNCTION postgis_geos_noop(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'GEOSnoop' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_DEFAULT; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Normalize(geom geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_Normalize' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- Deprecation in 1.5.0 CREATE OR REPLACE FUNCTION ST_zmflag(geometry) RETURNS smallint AS 'MODULE_PATHNAME', 'LWGEOM_zmflag' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_DEFAULT; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_NDims(geometry) RETURNS smallint AS 'MODULE_PATHNAME', 'LWGEOM_ndims' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_DEFAULT; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsEWKT(geometry) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asEWKT' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 750; --this looks suspicious, requires recheck + _COST_LOW; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_AsTWKB(geom geometry, prec int4 default NULL, prec_z int4 default NULL, prec_m int4 default NULL, with_sizes boolean default NULL, with_boxes boolean default NULL) RETURNS bytea AS 'MODULE_PATHNAME','TWKBFromLWGEOM' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_AsTWKB(geom geometry[], ids bigint[], prec int4 default NULL, prec_z int4 default NULL, prec_m int4 default NULL, with_sizes boolean default NULL, with_boxes boolean default NULL) RETURNS bytea AS 'MODULE_PATHNAME','TWKBFromLWGEOMArray' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsEWKB(geometry) RETURNS BYTEA AS 'MODULE_PATHNAME','WKBFromLWGEOM' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsHEXEWKB(geometry) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asHEXEWKB' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsHEXEWKB(geometry, text) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asHEXEWKB' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsEWKB(geometry,text) RETURNS bytea AS 'MODULE_PATHNAME','WKBFromLWGEOM' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_AsLatLonText(geom geometry, tmpl text DEFAULT '') RETURNS text AS 'MODULE_PATHNAME','LWGEOM_to_latlon' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Deprecation in 1.2.3 CREATE OR REPLACE FUNCTION GeomFromEWKB(bytea) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOMFromEWKB' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_GeomFromEWKB(bytea) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOMFromEWKB' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.2 CREATE OR REPLACE FUNCTION ST_GeomFromTWKB(bytea) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOMFromTWKB' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Deprecation in 1.2.3 CREATE OR REPLACE FUNCTION GeomFromEWKT(text) RETURNS geometry AS 'MODULE_PATHNAME','parse_WKT_lwgeom' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_GeomFromEWKT(text) RETURNS geometry AS 'MODULE_PATHNAME','parse_WKT_lwgeom' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION postgis_cache_bbox() @@ -1547,131 +1567,149 @@ CREATE OR REPLACE FUNCTION postgis_cache_bbox() CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8, float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.3.4 CREATE OR REPLACE FUNCTION ST_MakePointM(float8, float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoint3dm' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_3DMakeBox(geom1 geometry, geom2 geometry) RETURNS box3d AS 'MODULE_PATHNAME', 'BOX3D_construct' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_MakeLine (geometry[]) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makeline_garray' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_LineFromMultiPoint(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_line_from_mpoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_MakeLine(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makeline' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AddPoint(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_addpoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AddPoint(geom1 geometry, geom2 geometry, integer) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_addpoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_RemovePoint(geometry, integer) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_removepoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_SetPoint(geometry, integer, geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_setpoint_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.5.0 -- Availability: 2.0.0 - made srid optional CREATE OR REPLACE FUNCTION ST_MakeEnvelope(float8, float8, float8, float8, integer DEFAULT 0) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_MakeEnvelope' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_MakePolygon(geometry, geometry[]) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoly' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_MakePolygon(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoly' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_BuildArea(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_BuildArea' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_Polygonize (geometry[]) RETURNS geometry AS 'MODULE_PATHNAME', 'polygonize_garray' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 2.2 CREATE OR REPLACE FUNCTION ST_ClusterIntersecting(geometry[]) RETURNS geometry[] AS 'MODULE_PATHNAME', 'clusterintersecting_garray' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.2 CREATE OR REPLACE FUNCTION ST_ClusterWithin(geometry[], float8) RETURNS geometry[] AS 'MODULE_PATHNAME', 'cluster_within_distance_garray' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.3 CREATE OR REPLACE FUNCTION ST_ClusterDBSCAN (geometry, eps float8, minpoints int) RETURNS int AS 'MODULE_PATHNAME', 'ST_ClusterDBSCAN' - LANGUAGE 'c' IMMUTABLE STRICT WINDOW _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT WINDOW _PARALLEL + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_LineMerge(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'linemerge' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; ----------------------------------------------------------------------------- -- Affine transforms @@ -1682,7 +1720,7 @@ CREATE OR REPLACE FUNCTION ST_Affine(geometry,float8,float8,float8,float8,float8 RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_affine' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- reset cost, see #3675 -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Affine(geometry,float8,float8,float8,float8,float8,float8) @@ -1742,13 +1780,15 @@ CREATE OR REPLACE FUNCTION ST_Translate(geometry,float8,float8) CREATE OR REPLACE FUNCTION ST_Scale(geometry,geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_Scale' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_Scale(geometry,geometry,origin geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_Scale' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Scale(geometry,float8,float8,float8) @@ -1785,13 +1825,14 @@ CREATE OR REPLACE FUNCTION ST_Dump(geometry) RETURNS SETOF geometry_dump AS 'MODULE_PATHNAME', 'LWGEOM_dump' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_DumpRings(geometry) RETURNS SETOF geometry_dump AS 'MODULE_PATHNAME', 'LWGEOM_dump_rings' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; ----------------------------------------------------------------------- -- ST_DumpPoints() @@ -1800,7 +1841,7 @@ CREATE OR REPLACE FUNCTION ST_DumpRings(geometry) -- that returns a path and all the points that make up a particular geometry. -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_DumpPoints(geometry) - RETURNS SETOF geometry_dump + RETURNS SETOF geometry_dump AS 'MODULE_PATHNAME', 'LWGEOM_dumppoints' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL COST 100; @@ -2578,64 +2619,65 @@ BEGIN return sr; END; $$ -LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; +LANGUAGE 'plpgsql' STABLE STRICT _PARALLEL; --------------------------------------------------------------- -- PROJ support --------------------------------------------------------------- CREATE OR REPLACE FUNCTION get_proj4_from_srid(integer) RETURNS text AS -$$ -BEGIN + $$ + BEGIN RETURN proj4text::text FROM @extschema@.spatial_ref_sys WHERE srid= $1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; + END; + $$ + LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; -- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_SetSRID(geometry,int4) +CREATE OR REPLACE FUNCTION ST_SetSRID(geom geometry, srid int4) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_set_srid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; + _COST_LOW; -CREATE OR REPLACE FUNCTION ST_SRID(geometry) +CREATE OR REPLACE FUNCTION ST_SRID(geom geometry) RETURNS int4 AS 'MODULE_PATHNAME','LWGEOM_get_srid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_LOW; -CREATE OR REPLACE FUNCTION postgis_transform_geometry(geometry,text,text,int) +CREATE OR REPLACE FUNCTION postgis_transform_geometry(geom geometry, text, text, int) RETURNS geometry AS 'MODULE_PATHNAME','transform_geom' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- PostGIS equivalent of old function: transform(geometry,integer) CREATE OR REPLACE FUNCTION ST_Transform(geometry,integer) RETURNS geometry AS 'MODULE_PATHNAME','transform' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Transform(geom geometry, to_proj text) - RETURNS geometry AS -'SELECT @extschema@.postgis_transform_geometry($1, proj4text, $2, 0) -FROM spatial_ref_sys WHERE srid=@extschema@.ST_SRID($1);' - LANGUAGE sql IMMUTABLE STRICT _PARALLEL; + RETURNS geometry AS + 'SELECT @extschema@.postgis_transform_geometry($1, proj4text, $2, 0) + FROM spatial_ref_sys WHERE srid=@extschema@.ST_SRID($1);' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Transform(geom geometry, from_proj text, to_proj text) - RETURNS geometry AS -'SELECT @extschema@.postgis_transform_geometry($1, $2, $3, 0)' - LANGUAGE sql IMMUTABLE STRICT _PARALLEL; + RETURNS geometry AS + 'SELECT @extschema@.postgis_transform_geometry($1, $2, $3, 0)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Transform(geom geometry, from_proj text, to_srid integer) - RETURNS geometry AS -'SELECT @extschema@.postgis_transform_geometry($1, $2, proj4text, $3) -FROM spatial_ref_sys WHERE srid=$3;' - LANGUAGE sql IMMUTABLE STRICT _PARALLEL; + RETURNS geometry AS + 'SELECT @extschema@.postgis_transform_geometry($1, $2, proj4text, $3) + FROM spatial_ref_sys WHERE srid=$3;' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; ----------------------------------------------------------------------- -- POSTGIS_VERSION() @@ -2643,19 +2685,23 @@ FROM spatial_ref_sys WHERE srid=$3;' CREATE OR REPLACE FUNCTION postgis_version() RETURNS text AS 'MODULE_PATHNAME' - LANGUAGE 'c' IMMUTABLE; + LANGUAGE 'c' IMMUTABLE + _COST_DEFAULT; CREATE OR REPLACE FUNCTION postgis_liblwgeom_version() RETURNS text AS 'MODULE_PATHNAME' - LANGUAGE 'c' IMMUTABLE; + LANGUAGE 'c' IMMUTABLE + _COST_DEFAULT; CREATE OR REPLACE FUNCTION postgis_proj_version() RETURNS text AS 'MODULE_PATHNAME' - LANGUAGE 'c' IMMUTABLE; + LANGUAGE 'c' IMMUTABLE + _COST_DEFAULT; CREATE OR REPLACE FUNCTION postgis_wagyu_version() RETURNS text AS 'MODULE_PATHNAME' - LANGUAGE 'c' IMMUTABLE; + LANGUAGE 'c' IMMUTABLE + _COST_DEFAULT; -- -- IMPORTANT: @@ -2989,73 +3035,81 @@ CREATE OR REPLACE FUNCTION box2d(geometry) RETURNS box2d AS 'MODULE_PATHNAME','LWGEOM_to_BOX2D' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; CREATE OR REPLACE FUNCTION box3d(geometry) RETURNS box3d AS 'MODULE_PATHNAME','LWGEOM_to_BOX3D' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; CREATE OR REPLACE FUNCTION box(geometry) RETURNS box AS 'MODULE_PATHNAME','LWGEOM_to_BOX' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; CREATE OR REPLACE FUNCTION box2d(box3d) RETURNS box2d AS 'MODULE_PATHNAME','BOX3D_to_BOX2D' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION box3d(box2d) RETURNS box3d AS 'MODULE_PATHNAME','BOX2D_to_BOX3D' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION box(box3d) RETURNS box AS 'MODULE_PATHNAME','BOX3D_to_BOX' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION text(geometry) RETURNS text AS 'MODULE_PATHNAME','LWGEOM_to_text' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; + _COST_LOW; -- this is kept for backward-compatibility -- Deprecation in 1.2.3 CREATE OR REPLACE FUNCTION box3dtobox(box3d) RETURNS box AS 'MODULE_PATHNAME','BOX3D_to_BOX' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION geometry(box2d) RETURNS geometry AS 'MODULE_PATHNAME','BOX2D_to_LWGEOM' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION geometry(box3d) RETURNS geometry AS 'MODULE_PATHNAME','BOX3D_to_LWGEOM' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION geometry(text) RETURNS geometry AS 'MODULE_PATHNAME','parse_WKT_lwgeom' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION geometry(bytea) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_bytea' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION bytea(geometry) RETURNS bytea AS 'MODULE_PATHNAME','LWGEOM_to_bytea' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- 7.3+ explicit casting definitions CREATE CAST (geometry AS box2d) WITH FUNCTION box2d(geometry) AS IMPLICIT; @@ -3084,42 +3138,42 @@ CREATE OR REPLACE FUNCTION ST_Simplify(geometry, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_simplify2d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_Simplify(geometry, float8, boolean) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_simplify2d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_SimplifyVW(geometry, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_SetEffectiveArea' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_SetEffectiveArea(geometry, float8 default -1, integer default 1) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_SetEffectiveArea' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_FilterByM(geometry, double precision, double precision default null, boolean default false) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_FilterByM' LANGUAGE 'c' IMMUTABLE _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_ChaikinSmoothing(geometry, integer default 1, boolean default false) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_ChaikinSmoothing' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- ST_SnapToGrid(input, xoff, yoff, xsize, ysize) -- Availability: 1.2.2 @@ -3127,7 +3181,7 @@ CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, float8, float8, float8, float RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_snaptogrid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- ST_SnapToGrid(input, xsize, ysize) # offsets=0 -- Availability: 1.2.2 @@ -3135,7 +3189,7 @@ CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, float8, float8) RETURNS geometry AS 'SELECT @extschema@.ST_SnapToGrid($1, 0, 0, $2, $3)' LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- ST_SnapToGrid(input, size) # xsize=ysize=size, offsets=0 -- Availability: 1.2.2 @@ -3150,14 +3204,14 @@ CREATE OR REPLACE FUNCTION ST_SnapToGrid(geom1 geometry, geom2 geometry, float8, RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_snaptogrid_pointoff' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Segmentize(geometry, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_segmentize2d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; --------------------------------------------------------------- -- LRS @@ -3167,31 +3221,36 @@ CREATE OR REPLACE FUNCTION ST_Segmentize(geometry, float8) CREATE OR REPLACE FUNCTION ST_LineInterpolatePoint(geometry, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_line_interpolate_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_LineInterpolatePoints(geometry, float8, repeat boolean DEFAULT true) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_line_interpolate_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_LineSubstring(geometry, float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_line_substring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.1.0 CREATE OR REPLACE FUNCTION ST_LineLocatePoint(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'LWGEOM_line_locate_point' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_AddMeasure' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; --------------------------------------------------------------- -- TEMPORAL @@ -3201,25 +3260,29 @@ CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8) CREATE OR REPLACE FUNCTION ST_ClosestPointOfApproach(geometry, geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_ClosestPointOfApproach' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_DistanceCPA(geometry, geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_DistanceCPA' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_CPAWithin(geometry, geometry, float8) RETURNS bool AS 'MODULE_PATHNAME', 'ST_CPAWithin' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_IsValidTrajectory(geometry) RETURNS bool AS 'MODULE_PATHNAME', 'ST_IsValidTrajectory' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; --------------------------------------------------------------- -- GEOS @@ -3229,13 +3292,13 @@ CREATE OR REPLACE FUNCTION ST_Intersection(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME','ST_Intersection' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_Buffer(geom geometry, radius float8, options text DEFAULT '') RETURNS geometry AS 'MODULE_PATHNAME','buffer' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Buffer(geom geometry, radius float8, quadsegs integer) @@ -3245,63 +3308,66 @@ CREATE OR REPLACE FUNCTION ST_Buffer(geom geometry, radius float8, quadsegs inte -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_MinimumBoundingRadius(geometry, OUT center geometry, OUT radius double precision) - AS 'MODULE_PATHNAME', 'ST_MinimumBoundingRadius' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + AS 'MODULE_PATHNAME', 'ST_MinimumBoundingRadius' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(inputgeom geometry, segs_per_quarter integer DEFAULT 48) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_MinimumBoundingCircle' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_MinimumBoundingCircle' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_OrientedEnvelope(geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_OrientedEnvelope' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_OrientedEnvelope' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_OffsetCurve(line geometry, distance float8, params text DEFAULT '') - RETURNS geometry - AS 'MODULE_PATHNAME','ST_OffsetCurve' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 +RETURNS geometry + AS 'MODULE_PATHNAME','ST_OffsetCurve' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.3.0 -- Changed: 3.0.0 CREATE OR REPLACE FUNCTION ST_GeneratePoints(area geometry, npoints integer) - RETURNS geometry - AS 'MODULE_PATHNAME','ST_GeneratePoints' - LANGUAGE 'c' VOLATILE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 +RETURNS geometry + AS 'MODULE_PATHNAME','ST_GeneratePoints' + LANGUAGE 'c' VOLATILE STRICT _PARALLEL + _COST_HIGH; -- Availability: 3.0.0 CREATE OR REPLACE FUNCTION ST_GeneratePoints(area geometry, npoints integer, seed integer) - RETURNS geometry - AS 'MODULE_PATHNAME','ST_GeneratePoints' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; +RETURNS geometry + AS 'MODULE_PATHNAME','ST_GeneratePoints' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: convexhull(geometry) CREATE OR REPLACE FUNCTION ST_ConvexHull(geometry) RETURNS geometry AS 'MODULE_PATHNAME','convexhull' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 1.3.3 CREATE OR REPLACE FUNCTION ST_SimplifyPreserveTopology(geometry, float8) RETURNS geometry AS 'MODULE_PATHNAME','topologypreservesimplify' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry) RETURNS text AS 'MODULE_PATHNAME', 'isvalidreason' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1000; + _COST_HIGH; -- Availability: 2.0.0 CREATE TYPE valid_detail AS ( @@ -3315,18 +3381,17 @@ CREATE OR REPLACE FUNCTION ST_IsValidDetail(geom geometry, flags int4 DEFAULT 0) RETURNS valid_detail AS 'MODULE_PATHNAME', 'isvaliddetail' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1000; + _COST_HIGH; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry, int4) RETURNS text AS $$ -SELECT CASE WHEN valid THEN 'Valid Geometry' ELSE reason END FROM ( - SELECT (@extschema@.ST_isValidDetail($1, $2)).* -) foo + SELECT CASE WHEN valid THEN 'Valid Geometry' ELSE reason END FROM ( + SELECT (@extschema@.ST_isValidDetail($1, $2)).* + ) foo $$ - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_IsValid(geometry, int4) @@ -3339,64 +3404,70 @@ CREATE OR REPLACE FUNCTION ST_HausdorffDistance(geom1 geometry, geom2 geometry) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'hausdorffdistance' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_HausdorffDistance(geom1 geometry, geom2 geometry, float8) RETURNS FLOAT8 AS 'MODULE_PATHNAME', 'hausdorffdistancedensify' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 2.4.0 CREATE OR REPLACE FUNCTION ST_FrechetDistance(geom1 geometry, geom2 geometry, float8 default -1) - RETURNS FLOAT8 - AS 'MODULE_PATHNAME', 'ST_FrechetDistance' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + RETURNS FLOAT8 + AS 'MODULE_PATHNAME', 'ST_FrechetDistance' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: difference(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_Difference(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME','ST_Difference' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; --guessed based on ST_Intersection + _COST_HIGH; -- PostGIS equivalent function: boundary(geometry) CREATE OR REPLACE FUNCTION ST_Boundary(geometry) RETURNS geometry AS 'MODULE_PATHNAME','boundary' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_Points(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_Points' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- PostGIS equivalent function: symdifference(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_SymDifference(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME','symdifference' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_symmetricdifference(geom1 geometry, geom2 geometry) +CREATE OR REPLACE FUNCTION ST_SymmetricDifference(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME','symdifference' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: GeomUnion(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_Union(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME','ST_Union' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_UnaryUnion(geometry) RETURNS geometry AS 'MODULE_PATHNAME','ST_UnaryUnion' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- ST_RemoveRepeatedPoints(in geometry) -- @@ -3406,24 +3477,24 @@ CREATE OR REPLACE FUNCTION ST_UnaryUnion(geometry) -- -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_RemoveRepeatedPoints(geom geometry, tolerance float8 default 0.0) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_RemoveRepeatedPoints' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_RemoveRepeatedPoints' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_ClipByBox2d(geom geometry, box box2d) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_ClipByBox2d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 50; -- Guessed cost + _COST_HIGH; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_Subdivide(geom geometry, maxvertices integer DEFAULT 256) RETURNS setof geometry AS 'MODULE_PATHNAME', 'ST_Subdivide' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_CleanGeometry / ST_MakeValid @@ -3438,10 +3509,10 @@ CREATE OR REPLACE FUNCTION ST_Subdivide(geom geometry, maxvertices integer DEFAU -- -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_MakeValid(geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_MakeValid' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_MakeValid' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- ST_CleanGeometry(in geometry) -- @@ -3458,10 +3529,10 @@ CREATE OR REPLACE FUNCTION ST_MakeValid(geometry) -- -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_CleanGeometry(geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_CleanGeometry' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_CleanGeometry' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_Split @@ -3478,10 +3549,10 @@ CREATE OR REPLACE FUNCTION ST_CleanGeometry(geometry) -- Availability: 2.0.0 -- CREATE OR REPLACE FUNCTION ST_Split(geom1 geometry, geom2 geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_Split' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_Split' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_SharedPaths @@ -3500,10 +3571,10 @@ CREATE OR REPLACE FUNCTION ST_Split(geom1 geometry, geom2 geometry) -- Availability: 2.0.0 -- CREATE OR REPLACE FUNCTION ST_SharedPaths(geom1 geometry, geom2 geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_SharedPaths' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_SharedPaths' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_Snap @@ -3516,10 +3587,10 @@ CREATE OR REPLACE FUNCTION ST_SharedPaths(geom1 geometry, geom2 geometry) -- Availability: 2.0.0 -- CREATE OR REPLACE FUNCTION ST_Snap(geom1 geometry, geom2 geometry, float8) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_Snap' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_Snap' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_RelateMatch @@ -3532,10 +3603,10 @@ CREATE OR REPLACE FUNCTION ST_Snap(geom1 geometry, geom2 geometry, float8) -- Availability: 2.0.0 -- CREATE OR REPLACE FUNCTION ST_RelateMatch(text, text) - RETURNS bool - AS 'MODULE_PATHNAME', 'ST_RelateMatch' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + RETURNS bool + AS 'MODULE_PATHNAME', 'ST_RelateMatch' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -------------------------------------------------------------------------------- -- ST_Node @@ -3550,10 +3621,10 @@ CREATE OR REPLACE FUNCTION ST_RelateMatch(text, text) -- Availability: 2.0.0 -- CREATE OR REPLACE FUNCTION ST_Node(g geometry) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_Node' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_Node' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- ST_DelaunayTriangles @@ -3573,10 +3644,10 @@ CREATE OR REPLACE FUNCTION ST_Node(g geometry) -- Availability: 2.1.0 -- CREATE OR REPLACE FUNCTION ST_DelaunayTriangles(g1 geometry, tolerance float8 DEFAULT 0.0, flags int4 DEFAULT 0) - RETURNS geometry - AS 'MODULE_PATHNAME', 'ST_DelaunayTriangles' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + RETURNS geometry + AS 'MODULE_PATHNAME', 'ST_DelaunayTriangles' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -------------------------------------------------------------------------------- -- _ST_Voronoi @@ -3606,26 +3677,22 @@ CREATE OR REPLACE FUNCTION _ST_Voronoi(g1 geometry, clip geometry DEFAULT NULL, RETURNS geometry AS 'MODULE_PATHNAME', 'ST_Voronoi' LANGUAGE 'c' IMMUTABLE _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_VoronoiPolygons(g1 geometry, tolerance float8 DEFAULT 0.0, extend_to geometry DEFAULT NULL) RETURNS geometry AS $$ SELECT @extschema@._ST_Voronoi(g1, extend_to, tolerance, true) $$ - LANGUAGE SQL IMMUTABLE _PARALLEL - COST 1; -- reset cost, see #3675 + LANGUAGE 'sql' IMMUTABLE _PARALLEL; CREATE OR REPLACE FUNCTION ST_VoronoiLines(g1 geometry, tolerance float8 DEFAULT 0.0, extend_to geometry DEFAULT NULL) RETURNS geometry AS $$ SELECT @extschema@._ST_Voronoi(g1, extend_to, tolerance, false) $$ - LANGUAGE SQL IMMUTABLE _PARALLEL - COST 1; -- reset cost, see #3675 + LANGUAGE 'sql' IMMUTABLE _PARALLEL; -------------------------------------------------------------------------------- -- Aggregates and their supporting functions -------------------------------------------------------------------------------- ------------------------------------------------------------------------- - -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_CombineBBox(box3d,geometry) RETURNS box3d @@ -3644,8 +3711,6 @@ CREATE OR REPLACE FUNCTION ST_CombineBbox(box2d,geometry) AS 'MODULE_PATHNAME', 'BOX2D_combine' LANGUAGE 'c' IMMUTABLE _PARALLEL; - - -- Availability: 1.2.2 -- Changed: 2.2.0 to use non-deprecated ST_CombineBBox (r13535) -- Changed: 2.3.0 to support PostgreSQL 9.6 @@ -3876,33 +3941,38 @@ CREATE AGGREGATE ST_MakeLine (geometry) ( -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_ClusterKMeans(geom geometry, k integer) - RETURNS integer - AS 'MODULE_PATHNAME', 'ST_ClusterKMeans' - LANGUAGE 'c' VOLATILE STRICT WINDOW; + RETURNS integer + AS 'MODULE_PATHNAME', 'ST_ClusterKMeans' + LANGUAGE 'c' VOLATILE STRICT WINDOW + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry) RETURNS text AS 'MODULE_PATHNAME','relate_full' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry, int4) RETURNS text AS 'MODULE_PATHNAME','relate_full' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: relate(geom1 geometry, geom2 geometry,text) CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry,text) RETURNS boolean AS 'MODULE_PATHNAME','relate_pattern' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: disjoint(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_Disjoint(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','disjoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; ----------------------------------------------------------------------------- -- Non-indexed functions (see above for public indexed variants) @@ -3912,63 +3982,63 @@ CREATE OR REPLACE FUNCTION _ST_LineCrossingDirection(line1 geometry, line2 geome RETURNS integer AS 'MODULE_PATHNAME', 'ST_LineCrossingDirection' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.3.4 CREATE OR REPLACE FUNCTION _ST_DWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dwithin' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Touches(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','touches' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Intersects(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_Intersects' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Crosses(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','crosses' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Contains(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','contains' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION _ST_ContainsProperly(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','containsproperly' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Covers(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'covers' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_CoveredBy(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'coveredby' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION _ST_Within(geom1 geometry, geom2 geometry) @@ -3981,42 +4051,43 @@ CREATE OR REPLACE FUNCTION _ST_Overlaps(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','overlaps' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_DFullyWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_3DDWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dwithin3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_3DDFullyWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_3DIntersects(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'ST_3DIntersects' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_OrderingEquals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_same' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION _ST_Equals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_Equals' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; ----------------------------------------------------------------------------- @@ -4039,7 +4110,7 @@ CREATE OR REPLACE FUNCTION ST_LineCrossingDirection(geom1 geometry, geom2 geomet AS 'MODULE_PATHNAME', 'ST_LineCrossingDirection' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; -- Guessed cost + _COST_HIGH; -- Availability: 1.3.4 CREATE OR REPLACE FUNCTION ST_DWithin(geom1 geometry, geom2 geometry,float8) @@ -4047,7 +4118,7 @@ CREATE OR REPLACE FUNCTION ST_DWithin(geom1 geometry, geom2 geometry,float8) AS 'MODULE_PATHNAME', 'LWGEOM_dwithin' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Touches(geom1 geometry, geom2 geometry) @@ -4055,7 +4126,7 @@ CREATE OR REPLACE FUNCTION ST_Touches(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','touches' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry) @@ -4063,7 +4134,7 @@ CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','ST_Intersects' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Crosses(geom1 geometry, geom2 geometry) @@ -4071,7 +4142,7 @@ CREATE OR REPLACE FUNCTION ST_Crosses(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','crosses' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry) @@ -4079,7 +4150,7 @@ CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','contains' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_ContainsProperly(geom1 geometry, geom2 geometry) @@ -4087,7 +4158,7 @@ CREATE OR REPLACE FUNCTION ST_ContainsProperly(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','containsproperly' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Within(geom1 geometry, geom2 geometry) @@ -4095,7 +4166,7 @@ CREATE OR REPLACE FUNCTION ST_Within(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','within' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Covers(geom1 geometry, geom2 geometry) @@ -4103,7 +4174,7 @@ CREATE OR REPLACE FUNCTION ST_Covers(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME', 'covers' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_CoveredBy(geom1 geometry, geom2 geometry) @@ -4111,7 +4182,7 @@ CREATE OR REPLACE FUNCTION ST_CoveredBy(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME', 'coveredby' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_Overlaps(geom1 geometry, geom2 geometry) @@ -4119,48 +4190,49 @@ CREATE OR REPLACE FUNCTION ST_Overlaps(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME','overlaps' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_DFullyWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin' SUPPORT postgis_index_supportfn - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_3DDWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dwithin3d' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_3DDFullyWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin3d' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_3DIntersects(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'ST_3DIntersects' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_OrderingEquals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_same' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_Equals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_Equals' SUPPORT postgis_index_supportfn LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_HIGH; #else @@ -4233,38 +4305,33 @@ CREATE OR REPLACE FUNCTION ST_Overlaps(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_DFullyWithin(geom1 geometry, geom2 geometry, float8) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($2,$3) AND $2 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($1,$3) AND @extschema@._ST_DFullyWithin(@extschema@.ST_ConvexHull($1), @extschema@.ST_ConvexHull($2), $3)' - LANGUAGE 'sql' IMMUTABLE; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; CREATE OR REPLACE FUNCTION ST_3DDWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($2,$3) AND $2 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($1,$3) AND @extschema@._ST_3DDWithin($1, $2, $3)' - LANGUAGE 'sql' IMMUTABLE _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; CREATE OR REPLACE FUNCTION ST_3DDFullyWithin(geom1 geometry, geom2 geometry,float8) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($2,$3) AND $2 OPERATOR(@extschema@.&&) @extschema@.ST_Expand($1,$3) AND @extschema@._ST_3DDFullyWithin($1, $2, $3)' - LANGUAGE 'sql' IMMUTABLE _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; CREATE OR REPLACE FUNCTION ST_3DIntersects(geom1 geometry, geom2 geometry) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.&&) $2 AND @extschema@._ST_3DIntersects($1, $2)' - LANGUAGE 'sql' IMMUTABLE _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; CREATE OR REPLACE FUNCTION ST_OrderingEquals(GeometryA geometry, GeometryB geometry) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.~=) $2 AND @extschema@._ST_OrderingEquals($1, $2)' - LANGUAGE 'sql' IMMUTABLE _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; -- Availability: 1.2.1 CREATE OR REPLACE FUNCTION ST_Equals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'SELECT $1 OPERATOR(@extschema@.~=) $2 AND @extschema@._ST_Equals($1,$2)' - LANGUAGE 'sql' IMMUTABLE _PARALLEL - COST 100; + LANGUAGE 'sql' IMMUTABLE _PARALLEL; #endif @@ -4276,104 +4343,113 @@ CREATE OR REPLACE FUNCTION ST_IsValid(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'isvalid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1000; + _COST_HIGH; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_MinimumClearance(geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_MinimumClearance' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_MinimumClearanceLine(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_MinimumClearanceLine' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: Centroid(geometry) CREATE OR REPLACE FUNCTION ST_Centroid(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'centroid' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- Availability: 2.3.0 CREATE OR REPLACE FUNCTION ST_GeometricMedian(g geometry, tolerance float8 DEFAULT NULL, max_iter int DEFAULT 10000, fail_if_not_converged boolean DEFAULT false) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_GeometricMedian' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_HIGH; -- PostGIS equivalent function: IsRing(geometry) CREATE OR REPLACE FUNCTION ST_IsRing(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'isring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- PostGIS equivalent function: PointOnSurface(geometry) CREATE OR REPLACE FUNCTION ST_PointOnSurface(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'pointonsurface' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- PostGIS equivalent function: IsSimple(geometry) CREATE OR REPLACE FUNCTION ST_IsSimple(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'issimple' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 25; + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_IsCollection(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'ST_IsCollection' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_MEDIUM; -- Deprecation in 1.2.3 -- TODO: drop in 2.0.0 ! CREATE OR REPLACE FUNCTION Equals(geom1 geometry, geom2 geometry) RETURNS boolean AS 'MODULE_PATHNAME','ST_Equals' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; ----------------------------------------------------------------------- -- GML & KML INPUT ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION _ST_GeomFromGML(text, int4) - RETURNS geometry - AS 'MODULE_PATHNAME','geom_from_gml' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + RETURNS geometry + AS 'MODULE_PATHNAME','geom_from_gml' + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_GeomFromGML(text, int4) - RETURNS geometry - AS 'MODULE_PATHNAME','geom_from_gml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'MODULE_PATHNAME','geom_from_gml' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GeomFromGML(text) - RETURNS geometry - AS 'SELECT @extschema@._ST_GeomFromGML($1, 0)' - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'SELECT @extschema@._ST_GeomFromGML($1, 0)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GMLToSQL(text) - RETURNS geometry - AS 'SELECT @extschema@._ST_GeomFromGML($1, 0)' - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'SELECT @extschema@._ST_GeomFromGML($1, 0)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_GMLToSQL(text, int4) - RETURNS geometry - AS 'MODULE_PATHNAME','geom_from_gml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'MODULE_PATHNAME','geom_from_gml' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_GeomFromKML(text) RETURNS geometry AS 'MODULE_PATHNAME','geom_from_kml' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; ----------------------------------------------------------------------- -- GEOJSON INPUT @@ -4382,20 +4458,23 @@ CREATE OR REPLACE FUNCTION ST_GeomFromKML(text) CREATE OR REPLACE FUNCTION ST_GeomFromGeoJson(text) RETURNS geometry AS 'MODULE_PATHNAME','geom_from_geojson' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_GeomFromGeoJson(json) - RETURNS geometry - AS 'SELECT @extschema@.ST_GeomFromGeoJson($1::text)' - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'SELECT @extschema@.ST_GeomFromGeoJson($1::text)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; #if POSTGIS_PGSQL_VERSION >= 94 -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION ST_GeomFromGeoJson(jsonb) - RETURNS geometry - AS 'SELECT @extschema@.ST_GeomFromGeoJson($1::text)' - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + RETURNS geometry + AS 'SELECT @extschema@.ST_GeomFromGeoJson($1::text)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; #endif -- Availability: 2.0.0 @@ -4412,7 +4491,8 @@ CREATE OR REPLACE FUNCTION postgis_libjson_version() CREATE OR REPLACE FUNCTION ST_LineFromEncodedPolyline(txtin text, nprecision int4 DEFAULT 5) RETURNS geometry AS 'MODULE_PATHNAME','line_from_encoded_polyline' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; ------------------------------------------------------------------------ @@ -4424,7 +4504,8 @@ CREATE OR REPLACE FUNCTION ST_LineFromEncodedPolyline(txtin text, nprecision int CREATE OR REPLACE FUNCTION ST_AsEncodedPolyline(geom geometry, nprecision int4 DEFAULT 5) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asEncodedPolyline' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; ------------------------------------------------------------------------ @@ -4437,7 +4518,7 @@ CREATE OR REPLACE FUNCTION ST_AsSVG(geom geometry, rel int4 DEFAULT 0, maxdecima RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asSVG' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1000; + _COST_LOW; ----------------------------------------------------------------------- -- GML OUTPUT @@ -4447,7 +4528,7 @@ CREATE OR REPLACE FUNCTION _ST_AsGML(int4, geometry, int4, int4, text, text) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asGML' LANGUAGE 'c' IMMUTABLE _PARALLEL - COST 2500; + _COST_MEDIUM; -- ST_AsGML(version, geom) / precision=15 -- Availability: 1.3.2 @@ -4460,7 +4541,7 @@ CREATE OR REPLACE FUNCTION _ST_AsGML(int4, geometry, int4, int4, text, text) CREATE OR REPLACE FUNCTION ST_AsGML(geom geometry, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0) RETURNS TEXT AS $$ SELECT @extschema@._ST_AsGML(2, $1, $2, $3, null, null); $$ - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; -- ST_AsGML(version, geom, precision, option) -- Availability: 1.4.0 @@ -4484,7 +4565,7 @@ CREATE OR REPLACE FUNCTION ST_AsKML(geom geometry, maxdecimaldigits int4 DEFAULT RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asKML' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5000; + _COST_LOW; ----------------------------------------------------------------------- -- GEOJSON OUTPUT @@ -4497,7 +4578,7 @@ CREATE OR REPLACE FUNCTION ST_AsGeoJson(geom geometry, maxdecimaldigits int4 DEF RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asGeoJson' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1000; + _COST_LOW; ----------------------------------------------------------------------- -- Mapbox Vector Tile OUTPUT @@ -4538,25 +4619,29 @@ CREATE OR REPLACE FUNCTION pgis_asmvt_transfn(internal, anyelement, text, int4, CREATE OR REPLACE FUNCTION pgis_asmvt_finalfn(internal) RETURNS bytea AS 'MODULE_PATHNAME', 'pgis_asmvt_finalfn' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION pgis_asmvt_combinefn(internal, internal) RETURNS internal AS 'MODULE_PATHNAME', 'pgis_asmvt_combinefn' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION pgis_asmvt_serialfn(internal) RETURNS bytea AS 'MODULE_PATHNAME', 'pgis_asmvt_serialfn' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.5.0 CREATE OR REPLACE FUNCTION pgis_asmvt_deserialfn(bytea, internal) RETURNS internal AS 'MODULE_PATHNAME', 'pgis_asmvt_deserialfn' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.4.0 -- Changed: 2.5.0 @@ -4666,7 +4751,8 @@ CREATE OR REPLACE FUNCTION pgis_asgeobuf_transfn(internal, anyelement, text) CREATE OR REPLACE FUNCTION pgis_asgeobuf_finalfn(internal) RETURNS bytea AS 'MODULE_PATHNAME', 'pgis_asgeobuf_finalfn' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- Availability: 2.4.0 CREATE AGGREGATE ST_AsGeobuf(anyelement) @@ -4698,8 +4784,9 @@ CREATE AGGREGATE ST_AsGeobuf(anyelement, text) -- Changed 2.0.0 to use default args and named args CREATE OR REPLACE FUNCTION ST_GeoHash(geom geometry, maxchars int4 DEFAULT 0) RETURNS TEXT - AS 'MODULE_PATHNAME', 'ST_GeoHash' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + AS 'MODULE_PATHNAME', 'ST_GeoHash' + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; ----------------------------------------------------------------------- -- GeoHash input @@ -4709,19 +4796,22 @@ CREATE OR REPLACE FUNCTION ST_GeoHash(geom geometry, maxchars int4 DEFAULT 0) CREATE OR REPLACE FUNCTION ST_Box2dFromGeoHash(text, int4 DEFAULT NULL) RETURNS box2d AS 'MODULE_PATHNAME','box2d_from_geohash' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- ST_PointFromGeoHash(geohash text, precision int4) CREATE OR REPLACE FUNCTION ST_PointFromGeoHash(text, int4 DEFAULT NULL) RETURNS geometry AS 'MODULE_PATHNAME','point_from_geohash' - LANGUAGE 'c' IMMUTABLE _PARALLEL; + LANGUAGE 'c' IMMUTABLE _PARALLEL + _COST_MEDIUM; -- ST_GeomFromGeoHash(geohash text, precision int4) CREATE OR REPLACE FUNCTION ST_GeomFromGeoHash(text, int4 DEFAULT NULL) RETURNS geometry AS $$ SELECT CAST(@extschema@.ST_Box2dFromGeoHash($1, $2) AS geometry); $$ - LANGUAGE 'sql' IMMUTABLE _PARALLEL; + LANGUAGE 'sql' IMMUTABLE _PARALLEL + _COST_MEDIUM; ------------------------------------------------------------------------ -- OGC defined @@ -4730,70 +4820,78 @@ CREATE OR REPLACE FUNCTION ST_GeomFromGeoHash(text, int4 DEFAULT NULL) CREATE OR REPLACE FUNCTION ST_NumPoints(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_numpoints_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: NumGeometries(geometry) CREATE OR REPLACE FUNCTION ST_NumGeometries(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_numgeometries_collection' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: GeometryN(geometry) CREATE OR REPLACE FUNCTION ST_GeometryN(geometry,integer) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_geometryn_collection' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: Dimension(geometry) CREATE OR REPLACE FUNCTION ST_Dimension(geometry) RETURNS int4 AS 'MODULE_PATHNAME', 'LWGEOM_dimension' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: ExteriorRing(geometry) CREATE OR REPLACE FUNCTION ST_ExteriorRing(geometry) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_exteriorring_polygon' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: NumInteriorRings(geometry) CREATE OR REPLACE FUNCTION ST_NumInteriorRings(geometry) RETURNS integer AS 'MODULE_PATHNAME','LWGEOM_numinteriorrings_polygon' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_NumInteriorRing(geometry) RETURNS integer AS 'MODULE_PATHNAME','LWGEOM_numinteriorrings_polygon' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: InteriorRingN(geometry) CREATE OR REPLACE FUNCTION ST_InteriorRingN(geometry,integer) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_interiorringn_polygon' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Deprecation in 1.2.3 -- this should not be deprecated (2011-01-04 robe) CREATE OR REPLACE FUNCTION GeometryType(geometry) RETURNS text AS 'MODULE_PATHNAME', 'LWGEOM_getTYPE' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; -- COST guessed from ST_GeometryType(geometry) + _COST_LOW; -- Not quite equivalent to GeometryType CREATE OR REPLACE FUNCTION ST_GeometryType(geometry) RETURNS text AS 'MODULE_PATHNAME', 'geometry_geometrytype' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: PointN(geometry,integer) CREATE OR REPLACE FUNCTION ST_PointN(geometry,integer) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_pointn_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_NumPatches(geometry) @@ -4819,86 +4917,94 @@ CREATE OR REPLACE FUNCTION ST_PatchN(geometry, integer) CREATE OR REPLACE FUNCTION ST_StartPoint(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_startpoint_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function of old EndPoint(geometry) CREATE OR REPLACE FUNCTION ST_EndPoint(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_endpoint_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; -- PostGIS equivalent function: IsClosed(geometry) CREATE OR REPLACE FUNCTION ST_IsClosed(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_isclosed' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: IsEmpty(geometry) CREATE OR REPLACE FUNCTION ST_IsEmpty(geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_isempty' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_AsBinary(geometry,text) RETURNS bytea AS 'MODULE_PATHNAME','LWGEOM_asBinary' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent of old function: AsBinary(geometry) CREATE OR REPLACE FUNCTION ST_AsBinary(geometry) RETURNS bytea AS 'MODULE_PATHNAME','LWGEOM_asBinary' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 10; + _COST_LOW; -- PostGIS equivalent function: AsText(geometry) CREATE OR REPLACE FUNCTION ST_AsText(geometry) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asText' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 750; --guess + _COST_MEDIUM; -- Availability: 2.5.0 -- PostGIS equivalent function: AsText(geometry, int4) CREATE OR REPLACE FUNCTION ST_AsText(geometry, int4) RETURNS TEXT AS 'MODULE_PATHNAME','LWGEOM_asText' - LANGUAGE 'c' IMMUTABLE STRICT; + LANGUAGE 'c' IMMUTABLE STRICT + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_GeometryFromText(text) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_GeometryFromText(text, int4) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_GeomFromText(text) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- PostGIS equivalent function: ST_GeometryFromText(text, int4) CREATE OR REPLACE FUNCTION ST_GeomFromText(text, int4) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- PostGIS equivalent function: ST_GeometryFromText(text) -- SQL/MM alias for ST_GeomFromText CREATE OR REPLACE FUNCTION ST_WKTToSQL(text) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_text' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.2.2 CREATE OR REPLACE FUNCTION ST_PointFromText(text) @@ -5331,15 +5437,14 @@ CREATE OR REPLACE FUNCTION ST_GeomCollFromWKB(bytea) ' LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; ---New functions -- Maximum distance between linestrings. - -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION _ST_MaxDistance(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'LWGEOM_maxdistance2d_linestring' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 1.5.0 CREATE OR REPLACE FUNCTION ST_MaxDistance(geom1 geometry, geom2 geometry) @@ -5350,17 +5455,20 @@ CREATE OR REPLACE FUNCTION ST_MaxDistance(geom1 geometry, geom2 geometry) CREATE OR REPLACE FUNCTION ST_ClosestPoint(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_closestpoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_ShortestLine(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_shortestline2d' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; CREATE OR REPLACE FUNCTION _ST_LongestLine(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_longestline2d' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_LongestLine(geom1 geometry, geom2 geometry) RETURNS geometry @@ -5372,7 +5480,7 @@ CREATE OR REPLACE FUNCTION ST_SwapOrdinates(geom geometry, ords cstring) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_SwapOrdinates' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_LOW; -- NOTE: same as ST_SwapOrdinates(geometry, 'xy') -- but slightly faster in that it doesn't need to parse ordinate @@ -5381,7 +5489,7 @@ CREATE OR REPLACE FUNCTION ST_FlipCoordinates(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_FlipCoordinates' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; -- -- SFSQL 1.1 @@ -5470,13 +5578,9 @@ LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; -- Availability: 2.2.0 CREATE OR REPLACE FUNCTION ST_DistanceSphere(geom1 geometry, geom2 geometry) - RETURNS FLOAT8 - AS $$ - select @extschema@.ST_distance( @extschema@.geography($1), @extschema@.geography($2),false) - $$ - LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL - COST 300; - + RETURNS FLOAT8 AS + 'select @extschema@.ST_distance( @extschema@.geography($1), @extschema@.geography($2),false)' + LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL; --------------------------------------------------------------- -- GEOMETRY_COLUMNS view support functions @@ -5572,7 +5676,7 @@ $$ WHERE (upper(old_name) = upper($1) OR upper(new_name) = upper($1)) AND coord_dimension = $2; $$ -LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL COST 200; +LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL _COST_HIGH; -- Availability: 2.0.0 -- TODO: Can't deprecate this because UpdateGeometrySRID still uses them @@ -5591,7 +5695,7 @@ SELECT replace(replace(split_part(s.consrc, ' = ', 2), ')', ''), '(', '')::integ AND a.attnum = ANY (s.conkey) AND s.consrc LIKE '%srid(% = %'; $$ -LANGUAGE 'sql' STABLE STRICT _PARALLEL; +LANGUAGE 'sql' STABLE STRICT _PARALLEL _COST_MEDIUM; -- Availability: 2.0.0 -- TODO: Can't deprecate this because UpdateGeometrySRID still uses them @@ -5610,7 +5714,7 @@ SELECT replace(split_part(s.consrc, ' = ', 2), ')', '')::integer AND a.attnum = ANY (s.conkey) AND s.consrc LIKE '%ndims(% = %'; $$ -LANGUAGE 'sql' STABLE STRICT _PARALLEL; +LANGUAGE 'sql' STABLE STRICT _PARALLEL _COST_MEDIUM; -- support function to pull out geometry type from constraint check -- will return pretty name instead of ugly name @@ -5631,7 +5735,7 @@ SELECT replace(split_part(s.consrc, '''', 2), ')', '')::varchar AND a.attnum = ANY (s.conkey) AND s.consrc LIKE '%geometrytype(% = %'; $$ -LANGUAGE 'sql' STABLE STRICT _PARALLEL; +LANGUAGE 'sql' STABLE STRICT _PARALLEL _COST_MEDIUM; -- Availability: 2.0.0 -- Changed: 2.1.8 significant performance improvement for constraint based columns @@ -5702,32 +5806,31 @@ CREATE OR REPLACE FUNCTION ST_3DDistance(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_3DDistance' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_3DMaxDistance(geom1 geometry, geom2 geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'LWGEOM_maxdistance3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 100; + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_3DClosestPoint(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_closestpoint3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_3DShortestLine(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_shortestline3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 + _COST_MEDIUM; CREATE OR REPLACE FUNCTION ST_3DLongestLine(geom1 geometry, geom2 geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_longestline3d' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 1; -- reset cost, see #3675 - + _COST_MEDIUM; --------------------------------------------------------------- -- SQL-MM @@ -5737,7 +5840,8 @@ CREATE OR REPLACE FUNCTION ST_CoordDim(Geometry geometry) RETURNS smallint AS 'MODULE_PATHNAME', 'LWGEOM_ndims' LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL - COST 5; + _COST_LOW; + -- -- SQL-MM -- @@ -5760,17 +5864,20 @@ CREATE OR REPLACE FUNCTION ST_CoordDim(Geometry geometry) CREATE OR REPLACE FUNCTION ST_CurveToLine(geom geometry, tol float8 DEFAULT 32, toltype integer DEFAULT 0, flags integer DEFAULT 0) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_CurveToLine' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; CREATE OR REPLACE FUNCTION ST_HasArc(Geometry geometry) RETURNS boolean AS 'MODULE_PATHNAME', 'LWGEOM_has_arc' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; CREATE OR REPLACE FUNCTION ST_LineToCurve(Geometry geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_line_desegmentize' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_HIGH; ------------------------------------------------------------------------------- -- SQL/MM - SQL Functions on type ST_Point @@ -5780,7 +5887,7 @@ CREATE OR REPLACE FUNCTION ST_LineToCurve(Geometry geometry) CREATE OR REPLACE FUNCTION ST_Point(float8, float8) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_makepoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL _COST_LOW; -- PostGIS equivalent function: ST_MakePolygon(Geometry geometry) CREATE OR REPLACE FUNCTION ST_Polygon(geometry, int) @@ -5795,7 +5902,8 @@ CREATE OR REPLACE FUNCTION ST_Polygon(geometry, int) CREATE OR REPLACE FUNCTION ST_WKBToSQL(WKB bytea) RETURNS geometry AS 'MODULE_PATHNAME','LWGEOM_from_WKB' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_LOW; --- -- Linear referencing functions @@ -5804,26 +5912,30 @@ CREATE OR REPLACE FUNCTION ST_WKBToSQL(WKB bytea) CREATE OR REPLACE FUNCTION ST_LocateBetween(Geometry geometry, FromMeasure float8, ToMeasure float8, LeftRightOffset float8 default 0.0) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_LocateBetween' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_LocateAlong(Geometry geometry, Measure float8, LeftRightOffset float8 default 0.0) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_LocateAlong' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Only accepts LINESTRING as parameters. -- Availability: 1.4.0 CREATE OR REPLACE FUNCTION ST_LocateBetweenElevations(Geometry geometry, FromElevation float8, ToElevation float8) RETURNS geometry AS 'MODULE_PATHNAME', 'ST_LocateBetweenElevations' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- Availability: 2.0.0 CREATE OR REPLACE FUNCTION ST_InterpolatePoint(Line geometry, Point geometry) RETURNS float8 AS 'MODULE_PATHNAME', 'ST_InterpolatePoint' - LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL; + LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL + _COST_MEDIUM; -- moved to separate file cause its invovled #include "postgis_brin.sql.in" @@ -5911,7 +6023,7 @@ $$ END; $$ - LANGUAGE plpgsql IMMUTABLE STRICT _PARALLEL; +LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL _COST_HIGH; -- Availability: 2.0.0 -- Changed: 2.5.0 @@ -6073,7 +6185,7 @@ $$ RETURN var_resultgeom; END; $$ -LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL; +LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL _COST_HIGH; -- ST_ConcaveHull and Helper functions end here -- ----------------------------------------------------------------------- diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index d97f22911..9e5a3d63b 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -21,6 +21,25 @@ #define _PARALLEL_RESTRICTED #endif +/* + * High costs can only be used for PostGIS 3/PgSQL 12 + * where the support functions have been used in + * place of index SQL inlining. + * See https://trac.osgeo.org/postgis/ticket/3675 + * for sideffects of costing inlined SQL. + */ +#if POSTGIS_PGSQL_VERSION >= 120 +#define _COST_DEFAULT COST 1 +#define _COST_LOW COST 100 +#define _COST_MEDIUM COST 1000 +#define _COST_HIGH COST 10000 +#else +#define _COST_DEFAULT COST 1 +#define _COST_LOW COST 1 +#define _COST_MEDIUM COST 10 +#define _COST_HIGH COST 10 +#endif + /* * Define the build date and the version number * (these substitiutions are done with extra quotes sinces CPP -- 2.40.0