https://github.com/eschmar/great-circle-distance
MySQL vs PostgreSQL great-circle distance benchmarks
https://github.com/eschmar/great-circle-distance
benchmark mysql postgresql
Last synced: about 2 months ago
JSON representation
MySQL vs PostgreSQL great-circle distance benchmarks
- Host: GitHub
- URL: https://github.com/eschmar/great-circle-distance
- Owner: eschmar
- License: mit
- Created: 2018-05-23T10:23:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T17:03:28.000Z (over 7 years ago)
- Last Synced: 2025-02-08T21:16:53.132Z (over 1 year ago)
- Topics: benchmark, mysql, postgresql
- Language: Python
- Homepage:
- Size: 143 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Great-circle distance
MySQL vs PostgreSQL benchmarks. The system will generate tables containing test data. For that purpose, random points from areas within Sweden (see `data.geojson`) are chosen.
## setup
PostgreSQL requires the `earthdistance` package.
```sql
create extension cube;
create extension earthdistance;
```
Make sure your MySQL server instance contains a `geo` table.
```sh
# Generate and fill database tables necessary for benchmarks
make
# Run benchmarks
./mysql.sh
./postgres.sh
```
## select statements
```sql
-- MySQL
SELECT (6378.137 * acos(cos(radians(ST_X(p1))) * cos(radians(ST_X(p2))) * cos(radians(ST_Y(p2)) - radians(ST_Y(p1))) + sin(radians(ST_X(p1))) * sin(radians(ST_X(p2))))) AS distance
-- vs PostgreSQL
SELECT (p1 <@> p2) * 1.609344 AS distance
```
## results

The test bench was running an Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz.