Design PostGIS spatial database tables

design-postgis-tablesskillsetup L11,758
timescale/pg-aiguide
What it does

Design PostgreSQL schema with PostGIS extensions for geospatial queries

Best for

Enables sub-second spatial queries on millions of geometries through proper index design and CRS handling.

Inputs
  • · [object Object]
  • · [object Object]
  • · [object Object]
Outputs
  • · [object Object]
  • · [object Object]
  • · [object Object]
Requires
  • · PostgreSQL
  • · PostGIS extension
Preconditions

PostgreSQL cluster with PostGIS enabled

Failure modes

Wrong SRID causes silently wrong distance calculations; missing spatial indexes make queries slow on large tables

Trust signals
  • · GIST index creation templates
  • · SRID validation against EPSG registry
  • · Sample ST_Contains/ST_DWithin queries