# Geolocation with PostgreSQL

DevFeed: [Geolocation with PostgreSQL](<https://devfeed.tech/articles/geolocation-with-postgresql-34606.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2018/08/geolocation-with-postgresql/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2018-08-24T10:11:33Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [database](<https://devfeed.tech/tags/database.md>), [geolocation](<https://devfeed.tech/tags/geolocation.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [query](<https://devfeed.tech/tags/query.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

This tutorial shows how to load geolocation data from GeoLite CSV files into PostgreSQL with pgloader, define suitable tables, and query IP address ranges. It also describes using the ip4r extension and loading indexes in parallel.

## Source excerpt

We have loaded Open Street Map points of interests in the article The Most Popular Pub Names -- which compares PostgreSQL with MongoDB for simple geographical queries, and is part of our PostgreSQL Extensions article series. In today's article, look at how to geolocalize an IP address and locate the nearest pub, all within a single SQL query! For that, we are going to use the awesome ip4r extension from RhodiumToad.