SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Company Confidential. ©2010 Nokia
Nokia Internal Use Only
Spatial functions in
MySQL 5.6, MariaDB 5.5,
PostGIS 2.0 and others
Percona Live MySQL Conference and Expo 2013
Henrik Ingo
Senior Performance Architect, Nokia
(CC) 2013 Nokia. Please share and modify this presentation licensed with the Creative Commons Attribution license.
(CC BY) 2013 Nokia 2
GIS is a lot of things.
Open Geospatial Consortium defines lots of standards
• http://www.opengeospatial.org/standards/sfs
The one we are talking about is:
OpenGIS Implementation Specification for Geographic
information - Simple feature access - Part 2: SQL option
WHAT is GIS?
(CC BY) 2013 Nokia 3
Is the world flat, or a sphere?
GEOMETRY types GEOGRAPHY types
(CC BY) 2013 Nokia 4
It's neither!
But what about mountains and skyscrapers?
(CC BY) 2013 Nokia 5
Projections?
A
B C
Distance(A, B) = 0.0001 deg = 11 m
Distance(B, C) = 0.0001 deg = 8.5 m
(in Manhattan)
A
B C
All the lines above are straight.
(CC BY) 2013 Nokia 6
POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))
...
INSERT INTO geotable ( the_geom, the_name )
VALUES ( ST_GeomFromText('POINT(-126.4 45.32)', 312), 'A Place');
db=# SELECT road_id, ST_AsText(road_geom) AS geom, road_name FROM roads;
road_id | geom | road_name
--------+-----------------------------------------+-----------
1 | LINESTRING(191232 243118,191108 243242) | Jeff Rd
2 | LINESTRING(189141 244158,189265 244817) | Geordie Rd
3 | LINESTRING(192783 228138,192612 229814) | Paul St
4 | LINESTRING(189412 252431,189631 259122) | Graeme Ave
5 | LINESTRING(190131 224148,190871 228134) | Phil Tce
6 | LINESTRING(198231 263418,198213 268322) | Dave Cres
7 | LINESTRING(218421 284121,224123 241231) | Chris Way
(6 rows)
SELECT the_geom
FROM geom_table
WHERE ST_Distance(the_geom, ST_GeomFromText('POINT(100000 200000)')) < 100 AND type="road"
See also: http://blog.mariadb.org/screencast-mariadb-gis-demo/
Example SQL
(CC BY) 2013 Nokia 7
PostgreSQL MySQL & MariaDB MongoDB Solr SQLite
Standard feature PostGIS +
Extension
+ + + Spatialite
Type: Point + + + + +
Type: Geometry (x,y) + + * - +
Type: Geography (lat, lon) + - * - -
Type: 3D (ish) + - - - -
SRID projections + - * - +
Query by radius + ~ + + ~
Precise decimal math - MariaDB - - -
Query by bounding box + + * - +
Notes: Most
functions
don't support
Geography
MyISAM only WGS84 only
Limited
function set.
Indexes
have to be
explicitly
JOINed
Products that implement GIS
* Since MongoDB 2.4. This evaluation was done on v 2.0.
~ No, but you can query with bounding box (uses index) AND sort that result set by radius.
(CC BY) 2013 Nokia 8
Spatial use cases
-74.001417, 40.719811Canal Street, New York, USA
Geocoding
Reverse Geocoding
(text search)
(GIS)
Points-of-Interest
We are here
(CC BY) 2013 Nokia 9
• Scan HERE.com with script:
40.48, -75.23 to 42.42, -73.38
New York City
+ 4 neighbor states
+ Atlantic Ocean
• 0.0001 deg steps =
11 m vertically, 8.5 m horizontally
• 358M points
9.6M unique locations
• 7 days
Creating my data set
(CC BY) 2013 Nokia 10
SELECT * FROM Location
JOIN Point ON Location.id=Point.LocationId
WHERE Location.id=1;
id Label Country State County
1 E Sawmill Rd, Haycock Twp, PA
18951, United States
USA PA Bucks
PostalCode City District Street House
Number
Location
Type
18951 Haycock E Sawmill Rd street
1:n
(CC BY) 2013 Nokia 11
• GIS functions
used:
ST_Envelope()
ST_Union()
• Limitations in
Geography type
• 12 days
Bottlenecked by
CPU
Creating areas out of points
(CC BY) 2013 Nokia 12
My dataset!
(CC BY) 2013 Nokia 13
Accuracy compared to source = 93% (...5m margin of error)
(CC BY) 2013 Nokia 14
sql = """SELECT id,
ST_X(st_geomfromtext(st_astext("p"))) "x",
ST_Y(st_geomfromtext(st_astext("p"))) "y"
FROM "Point"
WHERE "Point"."LocationId" = %s"""
cur.execute(sql, [id] )
points = cur.fetchall()
for p in points :
db.point.insert({ "_id" : p['id'],
"LocationId" : id,
"p":[p['x'], p['y']] })
Migrating from SQL to NoSQL
Company Confidential. ©2010 Nokia
Nokia Internal Use Only
MongoDB requires points to be ordered as (lon, lat).
Python dictionaries are serialized in alphabetical
order.
YouareHERE
(CC BY) 2013 Nokia 16
SQL with polygons
SELECT *
FROM "GeomArea"
JOIN "Location" ON "GeomArea"."id" = "Location"."id"
WHERE ST_Within(ST_GeomFromEWKT('SRID=4326;POINT(<lon> <lat>)'), "p")
SQL with points
SELECT *
FROM Point
JOIN Location ON Point.LocationId = Location.id
WHERE ST_Within(p, ST_GeomFromText('POLYGON((<lon>+1 <lat>+1, <lon>+1 <lat>-1,
<lon>-1 <lat>-1, <lon>-1 <lat>+1,
<lon>+1 <lat>+1))'))
ORDER BY ST_Distance(ST_GeomFromText('POINT(<lon> <lat>)'), p)
MongoDB with points
point = db.point.find( { "p": { "$near" : [ lon, lat ] } } ).limit(1)
id = point[0]["LocationId"]
location = db.location.find_one( {"_id": id} )
Reverse geocoding HowTo
(CC BY) 2013 Nokia 17
Centos 6
8 CPUs, 32GB RAM, all tests with data set in RAM
PostGIS 9.1
MySQL 5.6.9 RC
MariaDB 5.5.29
MongoDB 2.0.7
Versions
(CC BY) 2013 Nokia 18
My data (GB) World (GB)
PostGIS polygons 34 165 240
PostGIS points 70 340 200
MySQL & MariaDB polygons 3.9 18 954
MySQL & MariaDB points 18 87 480
MongoDB 71 345 060
Data size (note that my data set not packed for optimal for size)
Size for World is extrapolated by multiplier 4860
This is based on 30% of the Earth surface being land
Polygons could be smoothened to reduce data set size by factor of 20-100
(CC BY) 2013 Nokia 19
Benchmark Results (data set in memory, 8 CPUs)
Clients TPS Avg RT (msec) 50% RT 98% RT
PostGIS polygons
1 138 7 6 18
4 547 7 6 18
8 1072 7 6 19
PostGIS points
1 419 2 2
4 1613 2 3
8 3136 3 3
PostGIS points disk bound: 100 TPS. Didn't scale with threads.
(CC BY) 2013 Nokia 20
Benchmark Results (data set in memory, 8 CPUs)
Clients TPS Avg RT (msec) 50% RT 98% RT
MySQL polygons
1 2866 0 0
4 10k 0 1
8 16.5k 0 1
MySQL points
1 1800 1 1
4 2110 2 3
8 1402 6 7
Using InnoDB for Location table (non-gis address data) was slightly faster for polygons.
Is MySQL faster because it doesn't support projections? -> Try PostGIS with SRID=0.
Points approach is stuck in "Creating sort index". (Should increase join buffers and tmp table.)
(CC BY) 2013 Nokia 21
Benchmark Results (data set in memory, 8 CPUs)
Clients TPS Avg RT (msec) 50% RT 98% RT
MariaDB polygons
1 2340 0 1
4 9146 0 1
8 15k 1 1
MariaDB points
1 1650 1 1
4 2270 2 2
8 1647 5 6
MariaDB GIS functions are independent of MySQL, but data format and indexes are the same.
Performance within +/- 10% of MySQL.
(CC BY) 2013 Nokia 22
Benchmark Results (data set in memory, 8 CPUs)
Clients TPS Avg RT (msec) 50% RT 98% RT
MongoDB points
1 411 2 2 2
4 454 9 3 20
8 525 14 7 25
PostGIS points
1 419 2 2
4 1613 2 3
8 3136 3 3
MySQL & MariaDB points
1 1650 1 1
4 2270 2 2
8 1647 5 6
(CC BY) 2013 Nokia 23
• Nice linear scalability, stable response times
• Most advanced, but "bolted on" user experience
• Wasteful in CPU and data size
• Decent on disk bound workload
• Polygon based performance a small disappointment
• Wishlist:
• No more feutures needed.
• Ease of use and performance please.
• Future: Real 3D
PostGIS Summary
(CC BY) 2013 Nokia 24
MongoDB
• Simple: Radius from point (Foursquare)
• Combinations possible: type=restaurant within 1 km
• Single thread performance ok, but didn't scale
• Could be issue with benchmark framework
• Main gotcha: don't use python dictionary for (lon, lat)
• 2.4 brings lots of enhancements, not covered here.
MongoDB Summary
(CC BY) 2013 Nokia 25
• 5x better than anything else
• For Within()
• Contention on sorting by Distance()
• Delivered on the vision of polygon based model
• Different implementations, same performance
• MySQL slightly faster, but within +/- 10%
• MariaDB has precise math operations
• Wishlist:
• Projections (SRID)
• InnoDB support
• Distance() using RTree index
MySQL & MariaDB Summary
Company Confidential. ©2010 Nokia
Nokia Internal Use Only
Thank you!
For more information
http://www.openlife.cc/blog
henrik.ingo@nokia.com

Contenu connexe

Tendances

Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGISmleslie
 
GeoServer an introduction for beginners
GeoServer an introduction for beginnersGeoServer an introduction for beginners
GeoServer an introduction for beginnersGeoSolutions
 
What's new in GeoServer 2.2
What's new in GeoServer 2.2What's new in GeoServer 2.2
What's new in GeoServer 2.2GeoSolutions
 
The State of the GeoServer project
The State of the GeoServer projectThe State of the GeoServer project
The State of the GeoServer projectGeoSolutions
 
Spatiotemporal Raster Improvements in GeoServer
Spatiotemporal Raster Improvements in GeoServerSpatiotemporal Raster Improvements in GeoServer
Spatiotemporal Raster Improvements in GeoServerGeoSolutions
 
Using GeoServer for spatio-temporal data management with examples for MetOc a...
Using GeoServer for spatio-temporal data management with examples for MetOc a...Using GeoServer for spatio-temporal data management with examples for MetOc a...
Using GeoServer for spatio-temporal data management with examples for MetOc a...GeoSolutions
 
State of GeoServer 2.14
State of GeoServer 2.14State of GeoServer 2.14
State of GeoServer 2.14Jody Garnett
 
Java Image Processing for Geospatial Community
Java Image Processing for Geospatial CommunityJava Image Processing for Geospatial Community
Java Image Processing for Geospatial CommunityJody Garnett
 
GeoServer Orientation
GeoServer OrientationGeoServer Orientation
GeoServer OrientationJody Garnett
 
Performance features12102 doag_2014
Performance features12102 doag_2014Performance features12102 doag_2014
Performance features12102 doag_2014Trivadis
 
MongoDB + GeoServer
MongoDB + GeoServerMongoDB + GeoServer
MongoDB + GeoServerMongoDB
 
Using PostGIS To Add Some Spatial Flavor To Your Application
Using PostGIS To Add Some Spatial Flavor To Your ApplicationUsing PostGIS To Add Some Spatial Flavor To Your Application
Using PostGIS To Add Some Spatial Flavor To Your ApplicationSteven Pousty
 
Wms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerWms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerDonnyV
 
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichData Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichRomeo Kienzler
 
GeoServer The Open Source Solution for the interoperable management of geos...
GeoServer The Open Source Solution  for the interoperable management  of geos...GeoServer The Open Source Solution  for the interoperable management  of geos...
GeoServer The Open Source Solution for the interoperable management of geos...GeoSolutions
 
Overview of MassGIS Web Mapping Services
Overview of MassGIS Web Mapping ServicesOverview of MassGIS Web Mapping Services
Overview of MassGIS Web Mapping Servicesaleda_freeman
 
Creating Stunning Maps in GeoServer: mastering SLD and CSS styles
Creating Stunning Maps in GeoServer: mastering SLD and CSS stylesCreating Stunning Maps in GeoServer: mastering SLD and CSS styles
Creating Stunning Maps in GeoServer: mastering SLD and CSS stylesGeoSolutions
 
State of GeoServer at FOSS4G-NA
State of GeoServer at FOSS4G-NAState of GeoServer at FOSS4G-NA
State of GeoServer at FOSS4G-NAGeoSolutions
 

Tendances (20)

Why is postgis awesome?
Why is postgis awesome?Why is postgis awesome?
Why is postgis awesome?
 
Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGIS
 
GeoServer an introduction for beginners
GeoServer an introduction for beginnersGeoServer an introduction for beginners
GeoServer an introduction for beginners
 
What's new in GeoServer 2.2
What's new in GeoServer 2.2What's new in GeoServer 2.2
What's new in GeoServer 2.2
 
The State of the GeoServer project
The State of the GeoServer projectThe State of the GeoServer project
The State of the GeoServer project
 
Spatiotemporal Raster Improvements in GeoServer
Spatiotemporal Raster Improvements in GeoServerSpatiotemporal Raster Improvements in GeoServer
Spatiotemporal Raster Improvements in GeoServer
 
Using GeoServer for spatio-temporal data management with examples for MetOc a...
Using GeoServer for spatio-temporal data management with examples for MetOc a...Using GeoServer for spatio-temporal data management with examples for MetOc a...
Using GeoServer for spatio-temporal data management with examples for MetOc a...
 
State of GeoServer 2.14
State of GeoServer 2.14State of GeoServer 2.14
State of GeoServer 2.14
 
Java Image Processing for Geospatial Community
Java Image Processing for Geospatial CommunityJava Image Processing for Geospatial Community
Java Image Processing for Geospatial Community
 
GeoServer Orientation
GeoServer OrientationGeoServer Orientation
GeoServer Orientation
 
Performance features12102 doag_2014
Performance features12102 doag_2014Performance features12102 doag_2014
Performance features12102 doag_2014
 
MongoDB + GeoServer
MongoDB + GeoServerMongoDB + GeoServer
MongoDB + GeoServer
 
Using PostGIS To Add Some Spatial Flavor To Your Application
Using PostGIS To Add Some Spatial Flavor To Your ApplicationUsing PostGIS To Add Some Spatial Flavor To Your Application
Using PostGIS To Add Some Spatial Flavor To Your Application
 
Wms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo ServerWms Performance Tests Map Server Vs Geo Server
Wms Performance Tests Map Server Vs Geo Server
 
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichData Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
 
Day 6 - PostGIS
Day 6 - PostGISDay 6 - PostGIS
Day 6 - PostGIS
 
GeoServer The Open Source Solution for the interoperable management of geos...
GeoServer The Open Source Solution  for the interoperable management  of geos...GeoServer The Open Source Solution  for the interoperable management  of geos...
GeoServer The Open Source Solution for the interoperable management of geos...
 
Overview of MassGIS Web Mapping Services
Overview of MassGIS Web Mapping ServicesOverview of MassGIS Web Mapping Services
Overview of MassGIS Web Mapping Services
 
Creating Stunning Maps in GeoServer: mastering SLD and CSS styles
Creating Stunning Maps in GeoServer: mastering SLD and CSS stylesCreating Stunning Maps in GeoServer: mastering SLD and CSS styles
Creating Stunning Maps in GeoServer: mastering SLD and CSS styles
 
State of GeoServer at FOSS4G-NA
State of GeoServer at FOSS4G-NAState of GeoServer at FOSS4G-NA
State of GeoServer at FOSS4G-NA
 

Similaire à Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others

State of GeoServer 2012
State of GeoServer 2012State of GeoServer 2012
State of GeoServer 2012Jody Garnett
 
Villar presentation.pdf
Villar presentation.pdfVillar presentation.pdf
Villar presentation.pdfEugenio Villar
 
State of GeoServer 2.10
State of GeoServer 2.10State of GeoServer 2.10
State of GeoServer 2.10Jody Garnett
 
Introduction to mago3D, an Open Source Based Digital Twin Platform
Introduction to mago3D, an Open Source Based Digital Twin PlatformIntroduction to mago3D, an Open Source Based Digital Twin Platform
Introduction to mago3D, an Open Source Based Digital Twin PlatformSANGHEE SHIN
 
State of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceOSCON Byrum
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsKohei KaiGai
 
WMS Performance Shootout 2011
WMS Performance Shootout 2011WMS Performance Shootout 2011
WMS Performance Shootout 2011Jeff McKenna
 
20160407_GTC2016_PgSQL_In_Place
20160407_GTC2016_PgSQL_In_Place20160407_GTC2016_PgSQL_In_Place
20160407_GTC2016_PgSQL_In_PlaceKohei KaiGai
 
mago3D FOSS4G NA 2018
mago3D FOSS4G NA 2018mago3D FOSS4G NA 2018
mago3D FOSS4G NA 2018정대 천
 
Location based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagLocation based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagMicrosoft Mobile Developer
 
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...Edge AI and Vision Alliance
 
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...Lars Aksel Opsahl
 
Open source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystemOpen source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystemHaNJiN Lee
 
What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2MariaDB plc
 
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...Massimiliano Cannata
 
Smallworld Data Check-Out to Microstation
Smallworld Data Check-Out to MicrostationSmallworld Data Check-Out to Microstation
Smallworld Data Check-Out to MicrostationSafe Software
 
State of GeoServer 2.12
State of GeoServer 2.12State of GeoServer 2.12
State of GeoServer 2.12GeoSolutions
 
Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Leng Kim Leng
 
pgconfasia2016 plcuda en
pgconfasia2016 plcuda enpgconfasia2016 plcuda en
pgconfasia2016 plcuda enKohei KaiGai
 
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...SANGHEE SHIN
 

Similaire à Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others (20)

State of GeoServer 2012
State of GeoServer 2012State of GeoServer 2012
State of GeoServer 2012
 
Villar presentation.pdf
Villar presentation.pdfVillar presentation.pdf
Villar presentation.pdf
 
State of GeoServer 2.10
State of GeoServer 2.10State of GeoServer 2.10
State of GeoServer 2.10
 
Introduction to mago3D, an Open Source Based Digital Twin Platform
Introduction to mago3D, an Open Source Based Digital Twin PlatformIntroduction to mago3D, an Open Source Based Digital Twin Platform
Introduction to mago3D, an Open Source Based Digital Twin Platform
 
State of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open Source
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
 
WMS Performance Shootout 2011
WMS Performance Shootout 2011WMS Performance Shootout 2011
WMS Performance Shootout 2011
 
20160407_GTC2016_PgSQL_In_Place
20160407_GTC2016_PgSQL_In_Place20160407_GTC2016_PgSQL_In_Place
20160407_GTC2016_PgSQL_In_Place
 
mago3D FOSS4G NA 2018
mago3D FOSS4G NA 2018mago3D FOSS4G NA 2018
mago3D FOSS4G NA 2018
 
Location based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagLocation based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tag
 
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...
“COVID-19 Safe Distancing Measures in Public Spaces with Edge AI,” a Presenta...
 
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...
Postgis_Topology_to_secure_data_integrity,_simple_API_and_clean_up_messy_simp...
 
Open source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystemOpen source based software ‘gxt’ mangosystem
Open source based software ‘gxt’ mangosystem
 
What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2
 
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...
Load testing of HELIDEM geo-portal: an OGC open standards interoperability ex...
 
Smallworld Data Check-Out to Microstation
Smallworld Data Check-Out to MicrostationSmallworld Data Check-Out to Microstation
Smallworld Data Check-Out to Microstation
 
State of GeoServer 2.12
State of GeoServer 2.12State of GeoServer 2.12
State of GeoServer 2.12
 
Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1
 
pgconfasia2016 plcuda en
pgconfasia2016 plcuda enpgconfasia2016 plcuda en
pgconfasia2016 plcuda en
 
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...
Let's integrate CAD/BIM/GIS on the same platform: A practical approach in rea...
 

Plus de Henrik Ingo

Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0Henrik Ingo
 
Meteor - The next generation software stack
Meteor - The next generation software stackMeteor - The next generation software stack
Meteor - The next generation software stackHenrik Ingo
 
MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 Henrik Ingo
 
Building Your First MongoDB App
Building Your First MongoDB AppBuilding Your First MongoDB App
Building Your First MongoDB AppHenrik Ingo
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorAnalytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorHenrik Ingo
 
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19Henrik Ingo
 
Failover or not to failover
Failover or not to failoverFailover or not to failover
Failover or not to failoverHenrik Ingo
 
Introducing Xtrabackup Manager
Introducing Xtrabackup ManagerIntroducing Xtrabackup Manager
Introducing Xtrabackup ManagerHenrik Ingo
 
Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Henrik Ingo
 
Froscon 2012 how big corporations play the open source game
Froscon 2012   how big corporations play the open source gameFroscon 2012   how big corporations play the open source game
Froscon 2012 how big corporations play the open source gameHenrik Ingo
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to GaleraHenrik Ingo
 
Databases and the Cloud
Databases and the CloudDatabases and the Cloud
Databases and the CloudHenrik Ingo
 
Fixed in drizzle
Fixed in drizzleFixed in drizzle
Fixed in drizzleHenrik Ingo
 
Choosing a MySQL High Availability solution - Percona Live UK 2011
Choosing a MySQL High Availability solution - Percona Live UK 2011Choosing a MySQL High Availability solution - Percona Live UK 2011
Choosing a MySQL High Availability solution - Percona Live UK 2011Henrik Ingo
 
Froscon2011: How i learned to use sql and then learned not to use it
Froscon2011:  How i learned to use sql and then learned not to use itFroscon2011:  How i learned to use sql and then learned not to use it
Froscon2011: How i learned to use sql and then learned not to use itHenrik Ingo
 
How to grow your open source project 10x and revenues 5x OSCON2011
How to grow your open source project 10x and revenues 5x OSCON2011How to grow your open source project 10x and revenues 5x OSCON2011
How to grow your open source project 10x and revenues 5x OSCON2011Henrik Ingo
 

Plus de Henrik Ingo (16)

Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0
 
Meteor - The next generation software stack
Meteor - The next generation software stackMeteor - The next generation software stack
Meteor - The next generation software stack
 
MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014
 
Building Your First MongoDB App
Building Your First MongoDB AppBuilding Your First MongoDB App
Building Your First MongoDB App
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop ConnectorAnalytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop Connector
 
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19
Whats new in mongoDB 2.4 at Copenhagen user group 2013-06-19
 
Failover or not to failover
Failover or not to failoverFailover or not to failover
Failover or not to failover
 
Introducing Xtrabackup Manager
Introducing Xtrabackup ManagerIntroducing Xtrabackup Manager
Introducing Xtrabackup Manager
 
Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)
 
Froscon 2012 how big corporations play the open source game
Froscon 2012   how big corporations play the open source gameFroscon 2012   how big corporations play the open source game
Froscon 2012 how big corporations play the open source game
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
Databases and the Cloud
Databases and the CloudDatabases and the Cloud
Databases and the Cloud
 
Fixed in drizzle
Fixed in drizzleFixed in drizzle
Fixed in drizzle
 
Choosing a MySQL High Availability solution - Percona Live UK 2011
Choosing a MySQL High Availability solution - Percona Live UK 2011Choosing a MySQL High Availability solution - Percona Live UK 2011
Choosing a MySQL High Availability solution - Percona Live UK 2011
 
Froscon2011: How i learned to use sql and then learned not to use it
Froscon2011:  How i learned to use sql and then learned not to use itFroscon2011:  How i learned to use sql and then learned not to use it
Froscon2011: How i learned to use sql and then learned not to use it
 
How to grow your open source project 10x and revenues 5x OSCON2011
How to grow your open source project 10x and revenues 5x OSCON2011How to grow your open source project 10x and revenues 5x OSCON2011
How to grow your open source project 10x and revenues 5x OSCON2011
 

Dernier

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Dernier (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others

  • 1. Company Confidential. ©2010 Nokia Nokia Internal Use Only Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others Percona Live MySQL Conference and Expo 2013 Henrik Ingo Senior Performance Architect, Nokia (CC) 2013 Nokia. Please share and modify this presentation licensed with the Creative Commons Attribution license.
  • 2. (CC BY) 2013 Nokia 2 GIS is a lot of things. Open Geospatial Consortium defines lots of standards • http://www.opengeospatial.org/standards/sfs The one we are talking about is: OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 2: SQL option WHAT is GIS?
  • 3. (CC BY) 2013 Nokia 3 Is the world flat, or a sphere? GEOMETRY types GEOGRAPHY types
  • 4. (CC BY) 2013 Nokia 4 It's neither! But what about mountains and skyscrapers?
  • 5. (CC BY) 2013 Nokia 5 Projections? A B C Distance(A, B) = 0.0001 deg = 11 m Distance(B, C) = 0.0001 deg = 8.5 m (in Manhattan) A B C All the lines above are straight.
  • 6. (CC BY) 2013 Nokia 6 POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) ... INSERT INTO geotable ( the_geom, the_name ) VALUES ( ST_GeomFromText('POINT(-126.4 45.32)', 312), 'A Place'); db=# SELECT road_id, ST_AsText(road_geom) AS geom, road_name FROM roads; road_id | geom | road_name --------+-----------------------------------------+----------- 1 | LINESTRING(191232 243118,191108 243242) | Jeff Rd 2 | LINESTRING(189141 244158,189265 244817) | Geordie Rd 3 | LINESTRING(192783 228138,192612 229814) | Paul St 4 | LINESTRING(189412 252431,189631 259122) | Graeme Ave 5 | LINESTRING(190131 224148,190871 228134) | Phil Tce 6 | LINESTRING(198231 263418,198213 268322) | Dave Cres 7 | LINESTRING(218421 284121,224123 241231) | Chris Way (6 rows) SELECT the_geom FROM geom_table WHERE ST_Distance(the_geom, ST_GeomFromText('POINT(100000 200000)')) < 100 AND type="road" See also: http://blog.mariadb.org/screencast-mariadb-gis-demo/ Example SQL
  • 7. (CC BY) 2013 Nokia 7 PostgreSQL MySQL & MariaDB MongoDB Solr SQLite Standard feature PostGIS + Extension + + + Spatialite Type: Point + + + + + Type: Geometry (x,y) + + * - + Type: Geography (lat, lon) + - * - - Type: 3D (ish) + - - - - SRID projections + - * - + Query by radius + ~ + + ~ Precise decimal math - MariaDB - - - Query by bounding box + + * - + Notes: Most functions don't support Geography MyISAM only WGS84 only Limited function set. Indexes have to be explicitly JOINed Products that implement GIS * Since MongoDB 2.4. This evaluation was done on v 2.0. ~ No, but you can query with bounding box (uses index) AND sort that result set by radius.
  • 8. (CC BY) 2013 Nokia 8 Spatial use cases -74.001417, 40.719811Canal Street, New York, USA Geocoding Reverse Geocoding (text search) (GIS) Points-of-Interest We are here
  • 9. (CC BY) 2013 Nokia 9 • Scan HERE.com with script: 40.48, -75.23 to 42.42, -73.38 New York City + 4 neighbor states + Atlantic Ocean • 0.0001 deg steps = 11 m vertically, 8.5 m horizontally • 358M points 9.6M unique locations • 7 days Creating my data set
  • 10. (CC BY) 2013 Nokia 10 SELECT * FROM Location JOIN Point ON Location.id=Point.LocationId WHERE Location.id=1; id Label Country State County 1 E Sawmill Rd, Haycock Twp, PA 18951, United States USA PA Bucks PostalCode City District Street House Number Location Type 18951 Haycock E Sawmill Rd street 1:n
  • 11. (CC BY) 2013 Nokia 11 • GIS functions used: ST_Envelope() ST_Union() • Limitations in Geography type • 12 days Bottlenecked by CPU Creating areas out of points
  • 12. (CC BY) 2013 Nokia 12 My dataset!
  • 13. (CC BY) 2013 Nokia 13 Accuracy compared to source = 93% (...5m margin of error)
  • 14. (CC BY) 2013 Nokia 14 sql = """SELECT id, ST_X(st_geomfromtext(st_astext("p"))) "x", ST_Y(st_geomfromtext(st_astext("p"))) "y" FROM "Point" WHERE "Point"."LocationId" = %s""" cur.execute(sql, [id] ) points = cur.fetchall() for p in points : db.point.insert({ "_id" : p['id'], "LocationId" : id, "p":[p['x'], p['y']] }) Migrating from SQL to NoSQL
  • 15. Company Confidential. ©2010 Nokia Nokia Internal Use Only MongoDB requires points to be ordered as (lon, lat). Python dictionaries are serialized in alphabetical order. YouareHERE
  • 16. (CC BY) 2013 Nokia 16 SQL with polygons SELECT * FROM "GeomArea" JOIN "Location" ON "GeomArea"."id" = "Location"."id" WHERE ST_Within(ST_GeomFromEWKT('SRID=4326;POINT(<lon> <lat>)'), "p") SQL with points SELECT * FROM Point JOIN Location ON Point.LocationId = Location.id WHERE ST_Within(p, ST_GeomFromText('POLYGON((<lon>+1 <lat>+1, <lon>+1 <lat>-1, <lon>-1 <lat>-1, <lon>-1 <lat>+1, <lon>+1 <lat>+1))')) ORDER BY ST_Distance(ST_GeomFromText('POINT(<lon> <lat>)'), p) MongoDB with points point = db.point.find( { "p": { "$near" : [ lon, lat ] } } ).limit(1) id = point[0]["LocationId"] location = db.location.find_one( {"_id": id} ) Reverse geocoding HowTo
  • 17. (CC BY) 2013 Nokia 17 Centos 6 8 CPUs, 32GB RAM, all tests with data set in RAM PostGIS 9.1 MySQL 5.6.9 RC MariaDB 5.5.29 MongoDB 2.0.7 Versions
  • 18. (CC BY) 2013 Nokia 18 My data (GB) World (GB) PostGIS polygons 34 165 240 PostGIS points 70 340 200 MySQL & MariaDB polygons 3.9 18 954 MySQL & MariaDB points 18 87 480 MongoDB 71 345 060 Data size (note that my data set not packed for optimal for size) Size for World is extrapolated by multiplier 4860 This is based on 30% of the Earth surface being land Polygons could be smoothened to reduce data set size by factor of 20-100
  • 19. (CC BY) 2013 Nokia 19 Benchmark Results (data set in memory, 8 CPUs) Clients TPS Avg RT (msec) 50% RT 98% RT PostGIS polygons 1 138 7 6 18 4 547 7 6 18 8 1072 7 6 19 PostGIS points 1 419 2 2 4 1613 2 3 8 3136 3 3 PostGIS points disk bound: 100 TPS. Didn't scale with threads.
  • 20. (CC BY) 2013 Nokia 20 Benchmark Results (data set in memory, 8 CPUs) Clients TPS Avg RT (msec) 50% RT 98% RT MySQL polygons 1 2866 0 0 4 10k 0 1 8 16.5k 0 1 MySQL points 1 1800 1 1 4 2110 2 3 8 1402 6 7 Using InnoDB for Location table (non-gis address data) was slightly faster for polygons. Is MySQL faster because it doesn't support projections? -> Try PostGIS with SRID=0. Points approach is stuck in "Creating sort index". (Should increase join buffers and tmp table.)
  • 21. (CC BY) 2013 Nokia 21 Benchmark Results (data set in memory, 8 CPUs) Clients TPS Avg RT (msec) 50% RT 98% RT MariaDB polygons 1 2340 0 1 4 9146 0 1 8 15k 1 1 MariaDB points 1 1650 1 1 4 2270 2 2 8 1647 5 6 MariaDB GIS functions are independent of MySQL, but data format and indexes are the same. Performance within +/- 10% of MySQL.
  • 22. (CC BY) 2013 Nokia 22 Benchmark Results (data set in memory, 8 CPUs) Clients TPS Avg RT (msec) 50% RT 98% RT MongoDB points 1 411 2 2 2 4 454 9 3 20 8 525 14 7 25 PostGIS points 1 419 2 2 4 1613 2 3 8 3136 3 3 MySQL & MariaDB points 1 1650 1 1 4 2270 2 2 8 1647 5 6
  • 23. (CC BY) 2013 Nokia 23 • Nice linear scalability, stable response times • Most advanced, but "bolted on" user experience • Wasteful in CPU and data size • Decent on disk bound workload • Polygon based performance a small disappointment • Wishlist: • No more feutures needed. • Ease of use and performance please. • Future: Real 3D PostGIS Summary
  • 24. (CC BY) 2013 Nokia 24 MongoDB • Simple: Radius from point (Foursquare) • Combinations possible: type=restaurant within 1 km • Single thread performance ok, but didn't scale • Could be issue with benchmark framework • Main gotcha: don't use python dictionary for (lon, lat) • 2.4 brings lots of enhancements, not covered here. MongoDB Summary
  • 25. (CC BY) 2013 Nokia 25 • 5x better than anything else • For Within() • Contention on sorting by Distance() • Delivered on the vision of polygon based model • Different implementations, same performance • MySQL slightly faster, but within +/- 10% • MariaDB has precise math operations • Wishlist: • Projections (SRID) • InnoDB support • Distance() using RTree index MySQL & MariaDB Summary
  • 26. Company Confidential. ©2010 Nokia Nokia Internal Use Only Thank you! For more information http://www.openlife.cc/blog henrik.ingo@nokia.com