postgis/postgis/sqldefines.h.in
Paul Ramsey 44e6da911a Reduce "high" and "medium" costs by a factor of two.
Follows this conversation:
https://lists.osgeo.org/pipermail/postgis-devel/2022-September/029818.html
Very high costs are flipping some plans badly.
Want to retain relatively large costs to promote parallel
plans and other things that are "good" for geospatial,
but walk the line carefully.

Closes #5259
2022-10-19 15:03:13 -07:00

63 lines
2.2 KiB
C

#ifndef _LWPGIS_DEFINES
#define _LWPGIS_DEFINES
#include "../postgis_revision.h"
/*
* Define just the version numbers; otherwise we get some strange substitutions in postgis.sql.in
*/
#define POSTGIS_PGSQL_VERSION @POSTGIS_PGSQL_VERSION@
#define POSTGIS_PGSQL_HR_VERSION @POSTGIS_PGSQL_HR_VERSION@
#define POSTGIS_GEOS_VERSION @POSTGIS_GEOS_VERSION@
#define POSTGIS_PROJ_VERSION @POSTGIS_PROJ_VERSION@
#define POSTGIS_LIB_VERSION '@POSTGIS_LIB_VERSION@'
#define POSTGIS_LIBXML2_VERSION @POSTGIS_LIBXML2_VERSION@
#define POSTGIS_SFCGAL_VERSION @POSTGIS_SFCGAL_VERSION@
/*
* 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 50
#define _COST_MEDIUM COST 250
#define _COST_HIGH COST 5000
#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
* won't substitute within apostrophes)
*/
#define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''@POSTGIS_VERSION@''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''@POSTGIS_BUILD_DATE@''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_PGSQL_VERSION 'SELECT ''@POSTGIS_PGSQL_VERSION@''::text AS version'
#ifdef POSTGIS_REVISION
/*
* Insert the PostGIS revision. This is immensely goofy because FreeBSD doesn't recognized
* PostGIS_REVISION as a variable if anything like ` or $rev$ (sql dollar quoting) abutts it so we need to leave a space on both sides
* which means we need to then trim it to get rid of the extra spaces we added.
* Maybe someone smarter can come up with a less goofy solution that makes all OS happy
*/
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT trim('@POSTGIS_SCRIPTS_VERSION@'::text || $rev$ POSTGIS_REVISION $rev$) AS version $$
#else
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '@POSTGIS_SCRIPTS_VERSION@'::text AS version $$
#endif
#define SRID_USR_MAX @SRID_USR_MAX@
#endif /* _LWPGIS_DEFINES */