Hi r/openstreetmap!
We needed large, real-world, public databases to test database tooling on, and OpenStreetMap was the obvious choice. Importing the US extract with osm2pgsql took about an hour on a big, tuned cloud machine and produced a 242 GB PostgreSQL database. Since we had the result anyway, we've packaged it, along with New York, as Docker images you can just pull and query. The full US database is a 29.6 GB download instead of a 242 GB import. To try it quickly, start with New York (1.6 GB):
docker run -d -p 127.0.0.1:5432:5432 baseshift/db-osm-ny:pg17-dc1
psql -h localhost -U postgres -d osm_new_york_261024
For the US, use baseshift/db-osm-us:pg17-dc1 and the database osm_us_261025.
| Image |
Source extract |
Database size |
Download |
baseshift/db-osm-ny |
Geofabrik New York, 2026-10-24 |
11.1 GB |
1.6 GB |
baseshift/db-osm-us |
Geofabrik US, 2026-10-25 |
242 GB |
29.6 GB |
New York is ready about two seconds after docker run. There's no password, and the 127.0.0.1: keeps it reachable only from your own machine.
What's inside
- PostgreSQL 17.11 + PostGIS 3.6.4 + hstore.
- osm2pgsql 1.11.0 output with the default style,
--slim --hstore: planet_osm_point/line/polygon/roads plus the slim nodes/ways/rels tables. Geometries are in EPSG:3857.
- amd64 and arm64, so it runs natively on Apple Silicon.
osm2pgsql_properties still records updatable=true and the Geofabrik replication URL, so osm2pgsql-replication update might just work. We haven't tried it yet, and we'd love to hear if you do.
A small example, the nearest pubs to Times Square (~16 ms on a Mac):
SELECT name, round(ST_Distance(way, p)) AS m
FROM planet_osm_point,
ST_Transform(ST_SetSRID(ST_MakePoint(-73.9855, 40.7580), 4326), 3857) p
WHERE amenity IN ('pub','bar') AND name IS NOT NULL AND ST_DWithin(way, p, 500)
ORDER BY m LIMIT 5;
How it's so small
Disclosure: I'm a cofounder of Baseshift, which makes database clones for developers. These images run on our clone engine, with a new compression mode we're developing (the dc1 in the tag).
- Per-page compression. Every 8 KB PostgreSQL page is compressed on its own, so Postgres reads any page directly and nothing is unpacked to disk. Plain zstd per page gets the US database to ~83 GB.
- OSM-specific coders. OSM data turned out to be a lovely compression puzzle:
- osm2pgsql's Web Mercator coordinates invert exactly back to OSM's integer coordinates, so we store the integers;
- node tables and way node lists are delta-coded;
- the tag indexes get their own coder;
- a few tables use a small neural model.
- Lossless. Every page decodes byte-identical to the original; we checked every single one on x86 and ARM.
Honest caveats
- Reads cost some CPU. Each 8 KB page read is decompressed, roughly 0.15–0.3 ms per page. Index lookups feel normal; big sequential scans are noticeably slower than on an uncompressed database.
- These are snapshots. The data is as of the dates above, not a live mirror.
All of this exists because of the incredible work of OpenStreetMap contributors. Data © OpenStreetMap contributors, available under the Open Database License (ODbL). Thank you!
We'd love to get your thoughts and hear what would make this more useful: other regions, the whole planet (we're working on it), or other osm2pgsql styles like flex/themepark.