
These two are often compared as alternatives, but they are not competing products: PostGIS is an extension that turns PostgreSQL into a spatial database. The real question is what changes when the extension is installed, and whether a given project needs it at all. This article compares a plain PostgreSQL database with the same database running PostGIS.
PostgreSQL vs PostGIS: What Is the Difference?
PostgreSQL is a general-purpose relational database that can store coordinates like any other numbers and has a small set of built-in geometric types. PostGIS adds spatial data types that carry a coordinate reference system, hundreds of functions for measuring and analysing geometry, index support tuned for spatial queries, and formats for exchanging data with GIS software.
PostgreSQL vs PostGIS
Feature | PostgreSQL without PostGIS | PostgreSQL with PostGIS |
Nature | Relational database engine | Extension installed into the database |
Spatial types | point, box, path, polygon, circle | geometry, geography, raster |
Coordinate systems | Not supported | spatial_ref_sys table and ST_Transform |
Standards | None | OGC Simple Features and SQL/MM |
Spatial functions | A few operators and distance | Several hundred ST_ functions |
Measurement on the ellipsoid | Approximate, via earthdistance | Exact, on the geography type |
Indexes | GiST, SP-GiST, BRIN on native types | Same index types on spatial types |
Exchange formats | Text and JSON only | WKT, WKB, GeoJSON, KML, vector tiles |
Raster data | Not supported | postgis_raster module |
3D and topology | Not supported | SFCGAL and postgis_topology |
GIS client access | As plain tables | Native layers in QGIS, ArcGIS Pro, GDAL |
Typical use | Attributes with latitude and longitude | Full spatial database |
What PostgreSQL Offers on Its Own
PostgreSQL has geometric types inherited from its early history: point, line, lseg, box, path, polygon and circle, with operators for containment and distance and GiST index support. They work on an abstract Cartesian plane with no notion of a coordinate system, no ellipsoid and no standard serialization, so they are usable for simple geometry but not for geographic data.
For basic distance work, the cube and earthdistance extensions compute great-circle distances on a sphere, which is enough to find the nearest branch or filter points within a radius. Storing coordinates as two numeric columns, or as GeoJSON in a jsonb column, is also common and works well until a query has to ask a genuinely spatial question.
What PostGIS Adds
The central addition is the geometry type, which stores points, lines, polygons and their collections together with an SRID identifying the coordinate system. With it come the ST_ functions defined by the OGC Simple Features and SQL/MM standards: relationships such as ST_Intersects and ST_Within, constructive operations such as ST_Buffer, ST_Union and ST_Intersection, measurement, validity checking and geometry repair.
Equally important is interoperability. PostGIS reads and writes WKT, WKB, GeoJSON, KML and vector tiles, and GIS clients treat its tables as native layers: QGIS, ArcGIS Pro, GeoServer and anything built on GDAL connect directly, so the database becomes the shared source of truth instead of a place where exported files are stored.
Geometry or geography
PostGIS offers two vector types. The geometry type works on a plane: coordinates are treated as Cartesian, which is fast and supports the full function library, but measurements are only meaningful in a projected coordinate system. The geography type works on the ellipsoid and returns metres for data stored in degrees, which is correct at any latitude and across large distances.
The practical rule is to use geography for global data and long distances, and geometry in a suitable projected system for local analysis, where it is faster and gives access to every function. Both can coexist, and ST_Transform converts between coordinate systems inside a query when needed.
Indexes and Performance
A spatial index is what makes the difference between a query that returns instantly and one that scans the whole table. PostGIS uses GiST indexes that compare bounding boxes first and run the exact geometry test only on surviving candidates, so an index on the geometry column is the first thing to create after loading data, followed by ANALYZE so the planner has current statistics.
Two habits matter more than any tuning parameter. Use ST_DWithin instead of comparing ST_Distance to a threshold, because only the former can use the index. And avoid calling ST_Transform on the indexed column inside a join or filter, since transforming the column on every row discards the index; transform the constant instead, or store a second column in the target system.
More Than Vector Data
PostGIS includes optional modules: postgis_raster for storing and analysing raster data in the database, postgis_topology for topological models where shared boundaries are stored once, and SFCGAL for 3D operations. ST_AsMVT generates vector tiles directly in SQL, which is the basis of lightweight tile servers such as pg_tileserv and Martin.
Around it sits a wider ecosystem of extensions that depend on PostGIS: pgRouting for network analysis and shortest paths, pgpointcloud for lidar, and MobilityDB for trajectories and moving-object data. This is the practical argument for putting spatial data in PostgreSQL rather than in files: the analysis moves to where the data already is.
Installation and Versions
Installation is a single statement, CREATE EXTENSION postgis, run in each database that needs it, with optional modules such as postgis_raster and postgis_topology enabled the same way. PostGIS is not enabled cluster-wide, which is why a table can be invisible to GIS clients in one database while another works fine.
Versions are tied together. PostGIS 3.6, released in September 2025 with maintenance releases through 2026, supports PostgreSQL 12 to 18 and depends on GEOS and PROJ, so an upgrade of the database usually means upgrading PostGIS and its libraries as well. After a major upgrade, postgis_extensions_upgrade() brings the installed extensions into line. Managed services such as Amazon RDS, Azure and Google Cloud SQL offer PostGIS, though usually a release or two behind the current version.
When Plain PostgreSQL Is Enough
If the database only stores a latitude and a longitude to display markers, and the most complex question is distance to a point, native types with earthdistance or a simple bounding-box filter will do. The same applies when coordinates are passed straight through to an application that does its own geometry work.
PostGIS becomes necessary as soon as questions involve relationships between objects: which polygon contains a point, which parcels a route crosses, how to aggregate by area, how to merge overlapping boundaries or reproject on the fly. Building that logic in application code is possible, but it means transferring geometry out of the database and losing the index.
Common Mistakes
The most common mistake is using the wrong SRID or none at all. A geometry stored with SRID 4326 but containing metres, or with SRID 0, will still accept queries and return numbers, and the error surfaces only when a distance looks implausible.
The second is measuring in degrees. ST_Distance on a geometry in EPSG:4326 returns degrees, not metres, so results look small and plausible while being meaningless. Casting to geography, or transforming to a projected system, fixes it.
The third is skipping validation. Self-intersecting polygons imported from other formats cause functions to fail or return wrong results; checking with ST_IsValid and repairing with ST_MakeValid after loading data prevents errors that are otherwise hard to trace.
FAQs
Is PostGIS a separate database?
No. It is an extension installed into a PostgreSQL database, so it uses the same server, the same backups, the same permissions and the same transactions as the rest of the data.
Does installing PostGIS slow down the database?
Not by itself. It adds types and functions that cost nothing when unused, and the only noticeable overhead is disk space for the extension and its reference data, such as the coordinate system table.
Can spatial data be stored without PostGIS?
Yes, as coordinate columns or GeoJSON in jsonb. The limitation is not storage but querying: without spatial types and indexes, relationship queries have to be written by hand and cannot use a spatial index.
Which is better, geometry or geography?
Neither in general. Geography is correct for global distances without reprojection; geometry in a projected system is faster and supports every function. Many databases hold both for the same data.
Do QGIS and ArcGIS Pro need PostGIS to connect?
They can read plain tables with coordinate columns, but working with them as spatial layers, with editing, spatial filters and server-side analysis, requires PostGIS.
Key Takeaways
The comparison is really between a database that stores coordinates and a database that understands them. PostgreSQL can hold spatial data and answer simple distance questions; PostGIS turns the same server into a spatial engine with coordinate systems, standards-based functions, spatial indexes and direct connections from GIS software.
Because the extension is free, mature and costs nothing when idle, the practical decision is rarely whether to install it, but whether the project's questions are spatial. Once queries start asking what contains what, what intersects what, and how much of something falls inside an area, the work belongs in the database rather than in exported files.



