MySQL 5.7 and MongoDB
|
|
- Julius Warner
- 6 years ago
- Views:
Transcription
1 MySQL 5.7 and MongoDB Geospatial Introduction Alexander Rubin - Principal Architect, Percona Mike Benshoof - Technical Account Manager, Percona
2 Agenda Introduction GIS in MySQL GIS in MongoDB 2
3 What is Geodata? Encompasses a wide array of topics Revolves around geo-positioning data (latitude/longitude) Point data (single lat/lon) Bounded areas (think radius from point) Defined area (think city limits outline on map) Often includes some function of distance Distance between points All points within x, y 3
4 Why do we care? Here are some commonly asked questions based around geodata: What are the 5 closest restaurants to my hotel? How far is it from here to the airport? How many restaurants are there within 25 miles of my hotel? These are all fairly common questions especially with the prevalence of geo-enabled devices (anyone here ever enable Location Services on their phone?) 4
5 Other Industries Oil/gas exploration Meteorology Logistics companies Travel companies < INSERT YOUR INDUSTRY HERE > The point: geodata is so readily available, you are likely already using it or will be soon! 5
6 High Level theory and formulas everyone s favorite Distance between points on sphere (The Haversine Formula): Everyone get out your calculators and slide rules... 6
7 En MySQL por favor... MySQL prior to 5.6 Get out your calculators MySQL 5.6 Introduced st_distance (built-in) MySQL 5.7 New spatial functions, InnoDB spatial indexes MySQL 8.0 (upcoming) The world is not flat any more (more below) 7
8 Enough with the theory already! = 37; = -133; = 38; = -133; SELECT (3959 * acos(cos(radians(@src_lat)) * cos(radians(@dest_lat)) * cos(radians(@dest_lng) - radians(@src_lng)) + sin(radians(@src_lat)) * sin( radians(@dest_lat)))) as GreatCircleDistance GreatCircleDistance Huzzah!! The distance between two latitude lines is ~69 miles! 8
9 now let s put it all together InnoDB Table Structure (pre 5.6) Find me all zip codes within 25 miles of my current zip code... CREATE TABLE `zipcodes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zip` varchar(255) DEFAULT NULL, `latitude` decimal(10,8) DEFAULT NULL, `longitude` decimal(11,8) DEFAULT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, `county` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `lat` (`latitude`,`longitude`), KEY `city` (`city`,`state`), KEY `state` (`state`), KEY `zip` (`zip`), KEY `county` (`county`) ) ENGINE=InnoDB 9
10 add some help Helper Function (pre 5.6) DELIMITER $$ DROP FUNCTION IF EXISTS DistanceInMiles$$ CREATE FUNCTION DistanceInMiles (src_lat decimal(10,8), src_lng decimal(11,8), dest_lat decimal(10,8), dest_lng decimal(11,8)) RETURNS decimal(15,8) DETERMINISTIC BEGIN RETURN CAST((3959 * acos(cos(radians( src_lat)) * cos(radians( dest_lat)) * cos(radians( dest_lng) - radians( src_lng)) + sin( radians( src_lat)) * sin( radians( dest_lat)))) as decimal(15,8)); END $$ DELIMITER ; 10
11 and results! mysql> # Norman, OK Post Office (73071) mysql> = ; Query OK, 0 rows affected (0.00 sec) mysql> = ; Query OK, 0 rows affected (0.00 sec) mysql> = 25; Query OK, 0 rows affected (0.00 sec) mysql> mysql> SELECT z.zip, z.city, z.state, -> z.latitude, z.longitude) as distance -> FROM zipcodes z -> HAVING distance -> ORDER BY distance -> LIMIT 10; ZIP City State distance NORMAN OK NORMAN OK NORMAN OK OKLAHOMA CITY OK NORMAN OK NOBLE OK OKLAHOMA CITY OK NORMAN OK NORMAN OK OKLAHOMA CITY OK rows in set (0.47 sec) 11
12 Not so great... mysql> EXPLAIN SELECT z.zip, z.city, z.state, z.latitude, z.longitude) as distance -> FROM zipcodes z -> HAVING distance -> ORDER BY distance -> LIMIT 10\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: z partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: filtered: Extra: Using temporary; Using filesort 1 row in set, 1 warning (0.00 sec) 12
13 More math to the rescue! Rather than scan the whole table, let s just look at a small rectangle of data (i.e. a bounding box): 1 o Latitude ~= 69 miles 1 o Longitude ~= cos(lat) * 69 $lat_range = radius / 69 $lng_range = abs(radius / (cos(lat) * 69)) $lon1 = $mylng + $lng_range $lon2 = $mylng - $lng_range $lat1 = $mylat +$lat_range $lat2 = $mylat - $lat_range 13
14 and respectable! mysql> SELECT z.zip, z.city, z.state, z.latitude, z.longitude) as distance -> FROM zipcodes z -> WHERE z.longitude BETWEEN AND > AND z.latitude BETWEEN AND > HAVING distance -> ORDER BY distance -> LIMIT 10; ZIP City State distance NORMAN OK NORMAN OK NORMAN OK OKLAHOMA CITY OK NORMAN OK NOBLE OK OKLAHOMA CITY OK NORMAN OK NORMAN OK OKLAHOMA CITY OK rows in set (0.00 sec) Updated Explain Plan: id: 1 select_type: SIMPLE table: z partitions: NULL type: range possible_keys: lat key: lat key_len: 13 ref: NULL rows: 1616 filtered: Extra: Using index condition; Using temporary;... 14
15 15 Onwards and upwards to Spatial Data Types!
16 Converting our table to geospatial... Non-Spatial way: Lat / Lon as individual decimal columns Composite B-Tree index covering each column Spatial way: Use the geometry type with a POINT object (single lat/lon) Use the geometry type with a POLYGON object (defined border) Use a SPATIAL index on the geometry column (MyISAM only through 5.6, added to InnoDB in 5.7) 16
17 And voila! CREATE TABLE `legacy`.`zipcodes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zip` varchar(255) DEFAULT NULL, `latitude` decimal(10,8) DEFAULT NULL, `longitude` decimal(11,8) DEFAULT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, `county` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `lat` (`latitude`,`longitude`), KEY `city` (`city`,`state`), KEY `state` (`state`), KEY `zip` (`zip`), KEY `county` (`county`) ) ENGINE=InnoDB CREATE TABLE `geospatial`.`zipcodes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zip` varchar(255) DEFAULT NULL, `geo` geometry NOT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, `county` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), SPATIAL KEY `geo` (`geo`), KEY `city` (`city`,`state`), KEY `state` (`state`) ) ENGINE=InnoDB Now, we can use GIS notation to find our zip code: SELECT zip, city, state, county, type, ST_AsText(geo) lon_lat FROM zipcodes WHERE ST_CONTAINS(geo, ST_GeomFromText('POINT( )', 4326)); 17
18 So What?! We had already written a query do just that And this one is still doing the same amount of handler operations! This opens up the opportunity to run other GIS based calculations as we'll see now... 18
19 Not just points! In earlier slides, we based everything on a single lat/lon coordinate Several zip code databases follow this model In recent years, the prevalence of full polygon region databases has increased Example: the US Census provided tl_2014_us_zcta510 schema... 19
20 Not just points! This table defines full regions for postal codes as opposed to a centered lat/lon for an actual building: 20 CREATE TABLE `zipcodes` ( `ogr_fid` int(11) NOT NULL AUTO_INCREMENT, `shape` geometry NOT NULL, `zcta5ce10` varchar(5) DEFAULT NULL, `geoid10` varchar(5) DEFAULT NULL, `classfp10` varchar(2) DEFAULT NULL, `mtfcc10` varchar(5) DEFAULT NULL, `funcstat10` varchar(1) DEFAULT NULL, `aland10` double DEFAULT NULL, `awater10` double DEFAULT NULL, `intptlat10` varchar(11) DEFAULT NULL, `intptlon10` varchar(12) DEFAULT NULL, PRIMARY KEY (`ogr_fid`), SPATIAL KEY `shape` (`shape`), KEY `zipcode` (`zcta5ce10`) ) ENGINE=InnoDB
21 Difference in storage Old version for Norman zip code 73071: ST_AsText(geo): POINT( ) New version in polygon based version: ST_AsText(shape): POLYGON(( , , , , , , , , , , , , , , , , , , ,... Note that now, we have a full region as opposed to a point... 21
22 GIS Functions st_contains Check if an object is entirely within another object st_within Check if an object is spatially within another object st_* Detailed list here: 22
23 Some Sample GIS Queries # Find me all the zipcodes (polygons) for my points of interest SELECT zip.zcta5ce10 AS zipcode, pts.name FROM my_points pts JOIN zipcodes zip ON st_within(pts.loc, zip.shape); # Find me all points of interest within a zip code (polygon) SELECT zip.zcta5ce10 AS zipcode, pts.name FROM my_points pts JOIN zipcodes zip ON st_contains(zip.shape, pts.loc) WHERE zip.zcta5ce10 = "73071"; 23
24 Some Sample GIS Queries # Find me all the points of interest within a county SELECT zip.zcta5ce10 AS zipcode, pts.name FROM my_points pts JOIN zipcodes zip ON st_contains(zip.shape, pts.loc) JOIN legacy.zipcodes leg ON leg.zip = zip.zcta5ce10 WHERE leg.county = "Cleveland"; 24
25 Impact of SPATIAL KEY I mentioned earlier that SPATIAL keys are available for InnoDB starting in 5.7 Here is just quick sample of the same query, with and without a SPATIAL key around a polygon Let s grab one of the earlier queries: SELECT raw.zcta5ce10 AS zipcode, pts.name FROM my_points pts JOIN tl_2014_us_zcta510 raw ON st_within(pts.loc, raw.shape); 25
26 Impact of SPATIAL KEY Without Key: zipcode name POI POI rows in set (57.38 sec) Variable_name Value Handler_read_first 2 Handler_read_key 2 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next Handler_write With Key: zipcode name POI POI rows in set (0.00 sec) Variable_name Value Handler_read_first 1 Handler_read_key 4 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 4 Handler_write
27 MySQL 8 - GIS Updates Spatial indexes for InnoDB (added in 5.7) ST_Distance() returns geodetic distance on the ellipsoid in meters! other functions still need helper functions (st_length() for example), but are being set to be updated in future versions ST_AsText() Returns lat/lon order based on spatial reference system MySQL now stores information about spatial reference systems other than SRID 0, for use with spatial data Note - all previous slides used SRID 4326 (geographical coordinates)
28 Quick Demo Collect points along a trip (GPX format) Load the raw file Determine geodata about each point Calculate total distance driven per county
29 Quick Demo mysql> explain SELECT raw.zcta5ce10 AS zipcode, raw.city, raw.county, raw.state, st_astext(pts.pt) FROM trip_tracker.raw_trip_points pts JOIN geopoly.geo_zips raw ON st_contains(raw.shape, pts.pt) WHERE pts.trip_id = 16\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: pts partitions: NULL type: ref possible_keys: loc,trip_idx key: trip_idx key_len: 4 ref: const rows: 5321 filtered: Extra: NULL *************************** 2. row *************************** id: 1 select_type: SIMPLE table: raw partitions: NULL type: ALL possible_keys: SHAPE key: NULL key_len: NULL ref: NULL rows: filtered: Extra: Range checked for each record (index map: 0x2)
30 Quick Demo Variable_name Value Handler_commit 1 Handler_delete 0 Handler_discover 0 Handler_external_lock 4 Handler_mrr_init 0 Handler_prepare 0 Handler_read_first 0 Handler_read_key 5323 Handler_read_last 0 Handler_read_next Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 0 Handler_rollback 0 Handler_savepoint 0 Handler_savepoint_rollback 0 Handler_update 0 Handler_write
31 MySQL 5.7: GeoJSON and Points of Interests ; = ; = ' ')'), 1); SELECT CONCAT('{ "type": "FeatureCollection", "features": [ ', GROUP_CONCAT('{ "type": "Feature", "geometry": ', ST_AsGeoJSON(shape), ', "properties": {"distance":', ', "name":"', name, '"} }' order by '] }') as j FROM points_new WHERE st_within(shape, 10)) and (other_tags like '%"amenity"=>"cafe"%' or other_tags like '%"amenity"=>"restaurant"%') and name is not null and < 450 limit 10;
32 Walk to lunch from Percona office
33 Points of Interest: data Openstreatmap: $ ogr2ogr -overwrite -progress -f "MySQL" MYSQL:osm,user=root north-america-latest.osm.pbf
34 Points of Interest: data mysql> select name, st_astext(shape), other_tags from points_new where other_tags like '%"amenity"=>"cafe"%' or other_tags like '%"amenity"=>"restaurant"%' and name is not null limit 10\G *************************** 1. row *************************** name: The Widow's Tavern and Grille st_astext(shape): POINT( ) other_tags: "amenity"=>"restaurant","old_name"=>"widow Brown's Tavern"
35 MySQL 5.7: Creating bounding box rectangle CREATE DEFINER = current_user() FUNCTION create_envelope(lat decimal(20, 14), lon decimal(20, 14), dist int) RETURNS geometry DETERMINISTIC begin declare point_text varchar(255); declare l varchar(255); declare p geometry; declare env geometry; declare rlon1 double; declare rlon2 double; declare rlat1 double; declare rlat2 double; set point_text = concat('point(', lon, ' ', lat, ')'); set p = ST_GeomFromText(point_text, 1); set rlon1 = lon-dist/abs(cos(radians(lat))*69); set rlon2 = lon+dist/abs(cos(radians(lat))*69); set rlat1 = lat-(dist/69); set rlat2 = lat+(dist/69); set l = concat('linestring(', rlon1, ' ', rlat1, ',', rlon2, ' ', rlat2, ')'); set env= ST_Envelope(ST_GeomFromText(l, 1)); return env; end //
36 MySQL Spatial Indexes in 5.7 No create_envelope mysql> explain SELECT.. FROM points_new WHERE (other_tags like '%"amenity"=>"cafe"%' or other_tags like '%"amenity"=>"restaurant"%') and name is not null and < 450 limit 10\G *************************** 1. row*************************** id: 1 select_type: SIMPLE table: points_new partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: filtered: Extra: Using where With create_envelope mysql> explain SELECT.. FROM points_new WHERE st_within(shape, 10)) (other_tags like '%"amenity"=>"cafe"%' or other_tags like '%"amenity"=>"restaurant"%') and name is not null and < 450 limit 10\G *************************** 1. row*************************** id: 1 select_type: SIMPLE table: points_new partitions: NULL type: range possible_keys: SHAPE key: SHAPE key_len: 34 ref: NULL rows: 665 filtered: Extra: Using where
37 Entering geonear Performs a geospatial query that returns the documents closest to a given point. geosearch Performs a geospatial query that uses MongoDB s haystack index functionality. Is not needed in Mongo...
38 From to MySQL 5.7 MongoDB 3.2 SELECT osm_id, name, round(st_distance_sphere(shape, st_geomfromtext('point ( )', 1) ), 2) as dist, st_astext(shape) FROM points_new WHERE 10)) and (other_tags like '%"amenity"=>"cafe"%' or other_tags like '%"amenity"=>"restaurant"%') and name is not null ORDER BY dist asc LIMIT 10; db.runcommand( { geonear: "points", near: { type: "Point", coordinates: [ , ] }, spherical: true, query: { name: { $exists: true, $ne:null}, "other_tags": { $in: [ /.*amenity=>restaurant.*/, /.*amenity=>cafe.*/ ] } }, "limit": 5, "maxdistance": } )
39 From to MySQL 5.7 MongoDB 3.2 mysql> SELECT osm_id, name, round(st_distance_sphere(shape, st_geomfromtext('point... -> ORDER BY dist asc LIMIT 10; osm_id name dist st_astext(shape) Pop's POINT( ) toast POINT( ) Pizzeria Toro POINT( ) Parker & Otis POINT( ) Torero's POINT( ) Fishmonger's POINT( ) Lilly's Pizza POINT( ) Dame's Chicken and Waffles POINT( ) El Rodeo POINT( ) Piazza Italia POINT( ) rows in set (0.21 sec) db.runcommand( { geonear: "points",... } ) Milliseconds: "stats" : { "nscanned" : 1728, "objectsloaded" : 1139, "avgdistance" : , "maxdistance" : , "time" : 17 }, "ok" : 1
40 From to Export from MySQL 5.7: mysql> SELECT JSON_OBJECT('name', replace(name, '"', ''), 'other_tags', replace(other_tags, '"', ''), 'geometry', st_asgeojson(shape)) as j FROM `points` INTO OUTFILE '/var/lib/mysql-files/points.json'; Query OK, rows affected (4 min 1.35 sec)
41 From to Load to MongoDB (parallel): mongoimport --db osm --collection points -j 24 --file /var/lib/mysql-files/points.json T22:38: connected to: localhost T22:38: [...] osm.points 31.8 MB/2.2 GB (1.4%) T22:38: [...] osm.points 31.8 MB/2.2 GB (1.4%) T22:38: [...] osm.points 31.8 MB/2.2 GB (1.4%) T23:12: [########################] osm.points 2.2 GB/2.2 GB (100.0%) T23:12: imported documents
42 From to Points json example (OpenStreetMap data) { "name": "Wendy's", "geometry": { "type": "Point", "coordinates": [ , ] }, "other_tags": "amenity=>fast_food" } GeoJSON
43 From to Creating index > use osm switched to db osm > db.points.createindex({ geometry : "2dsphere" } ) { "createdcollectionautomatically" : false, "numindexesbefore" : 1, "numindexesafter" : 2, "ok" : 1 }
44 From to Now trying lines collection ooops! > db.lines.createindex({ geometry : "2dsphere" } ) { "createdcollectionautomatically" : false, "numindexesbefore" : 1, "errmsg" : "exception: Can't extract geo keys: { _id: Same coordinates for start and end ObjectId(' f45f7f0d6dfbed2'), name: \"75 North\", geometry: { type: \"LineString\", coordinates: [ [ , ], [ , ] ] }, other_tags: \"tiger:cfcc=>a41,tiger:county=>kosciusko, IN,tiger:name_base=>75,tiger:name_direction_suffix=>N,tiger:reviewed=>no\" } GeoJSON LineString must have at least 2 vertices: [ [ , ], [ , ] ]", "code" : 16755, "ok" : 0 }
45 From to Removing the bad data is painful and slow but fixed the issue > db.lines.remove({"geometry.type": "LineString", "geometry.coordinates": {$size:2}, $where: "this.geometry.coordinates[0][0] == this.geometry.coordinates[1][0] && this.geometry.coordinates[0][1] == this.geometry.coordinates[1][1]" }) WriteResult({ "nremoved" : 22 }) $where is slow and acquire global lock
46 Find all cafes near our Durham, NC office: > db.runcommand( { geonear: "points", near: { type: "Point", coordinates: [ , ]}, spherical: true,... query: { "other_tags": { $in: [ /.*amenity=>restaurant.*/, /.*amenity=>cafe.*/ ] } }, "limit": 5, "maxdistance": } ) { "results" : [ { "dis" : , "obj" : { "_id" : ObjectId(" f45f7f0d66f8f13"), "name" : "Pop's", "geometry" : { "type" : "Point", "coordinates" : [ , ] }, "other_tags" : "addr:city=>durham,addr:country=>us,addr:ho usenumber=>605, addr:street=>west Main Street,amenity=>restaurant,building=>yes" }...
47 MySQL 5.7 and MongoDB: Geospatial Introduction Questions? 47
48 MySQL 5.7 and MongoDB: Geospatial Introduction Thanks! 48
MongoDB For MySQL DBAs. Alexander Rubin - Principal Architect, Percona
MongoDB For DBAs Alexander Rubin - Principal Architect, Percona Agenda How to in MongoDB Storage engines in MongoDB Opera4ons in MongoDB Replica4on in MongoDB Sharding in MongoDB Other examples 2 What
More informationAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning Alexander Rubin August 6, 2014 About Me My name is Alexander Rubin Working with MySQL for over 10 years Started at MySQL AB, then Sun Microsystems, then Oracle (MySQL Consulting)
More informationAdvanced query optimization techniques on large queries. Peter Boros Percona Webinar
Advanced query optimization techniques on large queries Peter Boros Percona Webinar Agenda Showing the title slide Going through this agenda Prerequisites Case study #1 Case study #2 Case study #3 Case
More informationSQL Query Patterns, Optimized
SQL Query Patterns, Optimized Bill Karwin Percona University 2013 Identify queries. How Do We Optimize? Measure optimization plan and performance. EXPLAIN SHOW SESSION STATUS SHOW PROFILES Add indexes
More informationMySQL Query Optimization. Originally: Query Optimization from 0 to 10 by Jaime Crespo
MySQL Query Optimization Originally: Query Optimization from 0 to 10 by Jaime Crespo Agenda 1. Introduction 7. Query Profiling 2. Access Types and Basic Indexing Techniques 8. General Optimizer Improvements
More informationMySQL vs MongoDB. Choosing right technology for your application. Peter Zaitsev CEO, Percona All Things Open, Raleigh,NC October 23 rd, 2017
MySQL vs MongoDB Choosing right technology for your application Peter Zaitsev CEO, Percona All Things Open, Raleigh,NC October 23 rd, 2017 1 MySQL vs MongoDB VS 2 Bigger Question What Open Source Database
More informationMySQL Query Patterns, Optimized
MySQL Query Patterns, Optimized Bill Karwin, Percona Welcome Everybody! Bill Karwin Senior Knowledge Manager in Percona Support Joined Percona in 2010 Percona offers MySQL services Consulting Support for
More informationQuery Optimization With MySQL 8.0 and MariaDB 10.3: The Basics
Query Optimization With MySQL 8.0 and MariaDB 10.3: The Basics Jaime Crespo Percona Live Europe 2018 -Frankfurt, 5 Nov 2018- dbahire.com/pleu18 Agenda 1. Introduction 6. Joins 2. Query Profiling 7. Subqueries
More informationMySQL Query Tuning 101. Sveta Smirnova, Alexander Rubin April, 16, 2015
MySQL Query Tuning 101 Sveta Smirnova, Alexander Rubin April, 16, 2015 Agenda 2 Introduction: where to find slow queries Indexes: why and how do they work All about EXPLAIN More tools Where to find more
More informationCovering indexes. Stéphane Combaudon - SQLI
Covering indexes Stéphane Combaudon - SQLI Indexing basics Data structure intended to speed up SELECTs Similar to an index in a book Overhead for every write Usually negligeable / speed up for SELECT Possibility
More informationTired of MySQL Making You Wait? Alexander Rubin, Principal Consultant, Percona Janis Griffin, Database Evangelist, SolarWinds
Tired of MySQL Making You Wait? Alexander Rubin, Principal Consultant, Percona Janis Griffin, Database Evangelist, SolarWinds Who Am I? Senior DBA / Performance Evangelist for Solarwinds Janis.Griffin@solarwinds.com
More informationAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning Alexander Rubin July 21, 2013 About Me My name is Alexander Rubin Working with MySQL for over 10 years Started at MySQL AB, then Sun Microsystems, then Oracle (MySQL Consulting)
More informationIndexes - What You Need to Know
Indexes - What You Need to Know http://www.percona.com/training/ 2011-2017 Percona, Inc. 1 / 53 Indexes - Need to Know QUERY PLANNING 2011-2017 Percona, Inc. 2 / 53 About This Chapter The number one goal
More informationOKC MySQL Users Group
OKC MySQL Users Group OKC MySQL Discuss topics about MySQL and related open source RDBMS Discuss complementary topics (big data, NoSQL, etc) Help to grow the local ecosystem through meetups and events
More informationPart 1: IoT demo Part 2: MySQL, JSON and Flexible storage
Part 1: IoT demo Part 2: MySQL, JSON and Flexible storage $ node particle_mysql_all.js Starting... INSERT INTO cloud_data_json (name, data) values ('particle', '{\"data\":\"null\",\"ttl\":60,\"published_at\":\"2017-09-28t19:40:49.869z\",\"coreid\":\"1f0039000947343337373738
More informationQuery Optimization Percona, Inc. 1 / 74
Query Optimization http://www.percona.com/training/ 2011-2017 Percona, Inc. 1 / 74 Table of Contents 1. Query Planning 3. Composite Indexes 2. Explaining the EXPLAIN 4. Kitchen Sink 2011-2017 Percona,
More informationPractical MySQL indexing guidelines
Practical MySQL indexing guidelines Percona Live October 24th-25th, 2011 London, UK Stéphane Combaudon stephane.combaudon@dailymotion.com Agenda Introduction Bad indexes & performance drops Guidelines
More informationHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong Bill Karwin, Square Inc. October, 2018 1 Me Database Developer at Square Inc. MySQL Quality Contributor Author of SQL Antipatterns: Avoiding the Pitfalls of Database Programming
More informationSpatial Data in MySQL 8.0
Spatial Data in MySQL 8.0 Norvald H. Ryeng Software Engineer Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and
More information1Z MySQL 5 Database Administrator Certified Professional Exam, Part II Exam.
Oracle 1Z0-874 MySQL 5 Database Administrator Certified Professional Exam, Part II Exam TYPE: DEMO http://www.examskey.com/1z0-874.html Examskey Oracle 1Z0-874 exam demo product is here for you to test
More informationOracle 1Z MySQL 5.6 Database Administrator. Download Full Version :
Oracle 1Z0-883 MySQL 5.6 Database Administrator Download Full Version : http://killexams.com/pass4sure/exam-detail/1z0-883 D. The mysqld binary was not compiled with SSL support. E. The server s SSL certificate
More information1. Create a spatial table
Create a spatial table Exercise Use the SAP HANA Web-based Development Workbench to get to know the spatial engine. Create a new column table and insert attributes with a new spatial data type. Time 15
More informationProject #2: A 3-Tiered Airport Lookup Service Using RPC
Project #2: A 3-Tiered Airport Lookup Service Using RPC 1. Objective Your assignment is to write a 3-tiered client-server program. The program will consist of three components: a client, a places server,
More informationGIS features in MariaDB and MySQL
GIS features in MariaDB and MySQL What has happened in recent years? Hartmut Holzgraefe Principal Support Engineer at MariaDB Inc. hartmut@mariadb.com August 20, 2016 Hartmut Holzgraefe (MariaDB Inc.)
More informationTroubleshooting Slow Queries. Sveta Smirnova Principal Support Engineer April, 28, 2016
Troubleshooting Slow Queries Sveta Smirnova Principal Support Engineer April, 28, 2016 Table of Contents Before we start What affects query execution EXPLAIN: how to find out how optimizer works Data matters:
More informationCopyright 2014, Oracle and/or its affiliates. All rights reserved.
Basic MySQL Troubleshooting for Oracle DBAs Sveta Smirnova Senior Principal Technical Support Engineer MySQL Support September 29, 2014 Safe Harbor Statement The following is intended to outline our general
More informationMySQL Performance Optimization
P R A C T I C A L MySQL Performance Optimization A hands-on, business-case-driven guide to understanding MySQL query parameter tuning and database performance optimization. With the increasing importance
More informationWriting High Performance SQL Statements. Tim Sharp July 14, 2014
Writing High Performance SQL Statements Tim Sharp July 14, 2014 Introduction Tim Sharp Technical Account Manager Percona since 2013 16 years working with Databases Optimum SQL Performance Schema Indices
More informationMongoDB. The Definitive Guide to. The NoSQL Database for Cloud and Desktop Computing. Eelco Plugge, Peter Membrey. and Tim Hawkins
The EXPERT s VOIce in Open Source The Definitive Guide to MongoDB The NoSQL Database for Cloud and Desktop Computing Simplify the storage of complex data by creating fast and scalable databases Eelco Plugge,
More informationNoSQL + SQL = MySQL. Nicolas De Rico Principal Solutions Architect
NoSQL + SQL = MySQL Nicolas De Rico Principal Solutions Architect nicolas.de.rico@oracle.com Safe Harbor Statement The following is intended to outline our general product direction. It is intended for
More informationMaximizing SQL reviews with pt-query-digest
PALOMINODB OPERATIONAL EXCELLENCE FOR DATABASES Maximizing SQL reviews with pt-query-digest Mark Filipi www.palominodb.com What is pt-query-digest Analyzes MySQL queries from slow, general and binary log
More informationApplied Databases. Sebastian Maneth. Lecture 9 Spacial Queries and Indexes. University of Edinburgh - February 13th, 2017
Applied Databases Lecture 9 Spacial Queries and Indexes Sebastian Maneth University of Edinburgh - February 13th, 2017 2 Outline 1. Assignment 2 2. Spatial Types 3. Spatial Queries 4. R-Trees 3 Assignment
More informationMySQL Schema Review 101
MySQL Schema Review 101 How and What you should be looking at... Mike Benshoof - Technical Account Manager, Percona Agenda Introduction Key things to consider and review Tools to isolate issues Common
More informationMongoDB An Overview. 21-Oct Socrates
MongoDB An Overview 21-Oct-2016 Socrates Agenda What is NoSQL DB? Types of NoSQL DBs DBMS and MongoDB Comparison Why MongoDB? MongoDB Architecture Storage Engines Data Model Query Language Security Data
More informationMySQL vs MariaDB. Where are we now?
MySQL vs MariaDB Where are we now? Hey! A BRIEF HISTORY OF THE UNIVERSE (of MySQL and MariaDB) Herman Hollerith Unireg Begins Essentially, the origin of what we know MySQL as today, establishing its code
More informationMongoDB schema design
Welcome! MongoDB schema design PHP NorthWest - Manchester, UK - Apr 3rd, 2012 Derick Rethans - derick@10gen.com - twitter: @derickr e-mail me About Me Derick Rethans Dutchman living in London PHP mongodb
More informationChapter 9. Attribute joins
Chapter 9 Spatial Joins 9-1 Copyright McGraw-Hill Education. Permission required for reproduction or display. Attribute joins Recall that Attribute joins: involve combining two attribute tables together
More informationMySQL Indexing. Best Practices for MySQL 5.6. Peter Zaitsev CEO, Percona MySQL Connect Sep 22, 2013 San Francisco,CA
MySQL Indexing Best Practices for MySQL 5.6 Peter Zaitsev CEO, Percona MySQL Connect Sep 22, 2013 San Francisco,CA For those who Does not Know Us Percona Helping Businesses to be Successful with MySQL
More informationOptimizer Standof. MySQL 5.6 vs MariaDB 5.5. Peter Zaitsev, Ovais Tariq Percona Inc April 18, 2012
Optimizer Standof MySQL 5.6 vs MariaDB 5.5 Peter Zaitsev, Ovais Tariq Percona Inc April 18, 2012 Thank you Ovais Tariq Ovais Did a lot of heavy lifing for this presentation He could not come to talk together
More information<Insert Picture Here> Upcoming Changes in MySQL 5.7 Morgan Tocker, MySQL Community Manager
Upcoming Changes in MySQL 5.7 Morgan Tocker, MySQL Community Manager http://www.tocker.ca/ Safe Harbor Statement The following is intended to outline our general product direction.
More informationMySQL Indexing. Best Practices. Peter Zaitsev, CEO Percona Inc August 15, 2012
MySQL Indexing Best Practices Peter Zaitsev, CEO Percona Inc August 15, 2012 You ve Made a Great Choice! Understanding indexing is crucial both for Developers and DBAs Poor index choices are responsible
More informationWhen and How to Take Advantage of New Optimizer Features in MySQL 5.6. Øystein Grøvlen Senior Principal Software Engineer, MySQL Oracle
When and How to Take Advantage of New Optimizer Features in MySQL 5.6 Øystein Grøvlen Senior Principal Software Engineer, MySQL Oracle Program Agenda Improvements for disk-bound queries Subquery improvements
More informationRudi Bruchez. From relational to Multimodel Azure Cosmos DB
Rudi Bruchez From relational to Multimodel Azure Cosmos DB Yes, it s me Rudi Bruchez rudi@babaluga.com www.babaluga.com Overview Introduction to CosmosDB What is Azure CosmosDB Cosmos DB started in 2010
More informationOSM data in MariaDB/MySQL All the world in a few large tables
OSM data in MariaDB/MySQL All the world in a few large tables Well, almost... Hartmut Holzgraefe SkySQL AB hartmut@skysql.com February 1, 2014 Hartmut Holzgraefe (SkySQL) OSM data in MariaDB/MySQL February
More informationWhat to expect from MySQL 8.0?
What to expect from MySQL 8.0? Norvald H. Ryeng Software Engineer FOSDEM 2017 Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes
More informationPaul Ramsey PostGIS Gotchas. The Things You Didn't Know That Lead to Confusion and Dismay. Wednesday, November 18, 15
Paul Ramsey PostGIS Gotchas The Things You Didn't Know That Lead to Confusion and Dismay Happy GIS day! What do you call the day after GIS day? PostGIS Day is tomorrow Paul Ramsey
More informationExplaining the MySQL EXPLAIN
Explaining the MySQL EXPLAIN Ronald Bradford http://ronaldbradford.com OTN South America Tour July 2011 Agenda EXPLAIN syntax options How to read QEP QEP examples MySQL optimizer limitations PURPOSE EXPLAIN
More informationPractical Performance Tuning using Digested SQL Logs. Bob Burgess Salesforce Marketing Cloud
Practical Performance Tuning using Digested SQL Logs Bob Burgess Salesforce Marketing Cloud Who?! Database Architect! Salesforce Marketing Cloud (Radian6 & Buddy Media stack) Why?! I can t be the only
More information5 Extract the information of location from the geometry column of PostgreSQL table
5 Extract the information of location from the geometry column of PostgreSQL table Open QGIS and load PostGIS layer buildings and the raster layer Tai_wide_G (optional just to show the basemap). 1 Click
More informationHow to calculate population and jobs within ½ mile radius of site
How to calculate population and jobs within ½ mile radius of site Caltrans Project P359, Trip Generation Rates for Transportation Impact Analyses of Smart Growth Land Use Projects SECTION PAGE Population
More informationOptimizing Queries with EXPLAIN
Optimizing Queries with EXPLAIN Sheeri Cabral Senior Database Administrator Twitter: @sheeri What is EXPLAIN? SQL Extension Just put it at the beginning of your statement Can also use DESC or DESCRIBE
More informationCSED421 Database Systems Lab. Index
CSED421 Database Systems Lab Index Index of Index What is an index? When to Create an Index or Not? Index Syntax UNIQUE Index / Indexing Prefixes / Multiple-column index Confirming indexes Index types
More informationMapping Tabular Data Display XY points from csv
Mapping Tabular Data Display XY points from csv Materials needed: AussiePublicToilets.csv. [1] Open and examine the data: Open ArcMap and use the Add Data button to add the table AussiePublicToilets.csv
More informationMySQL 5.7 For Operational DBAs an Introduction. Peter Zaitsev, CEO, Percona February 16, 2016 Percona Technical Webinars
MySQL 5.7 For Operational DBAs an Introduction Peter Zaitsev, CEO, Percona February 16, 2016 Percona Technical Webinars MySQL 5.7 is Great! A lot of Worthy Changes for Developers and DBAs 2 What Developers
More informationPostgreSQL to MySQL A DBA's Perspective. Patrick
PostgreSQL to MySQL A DBA's Perspective Patrick King @mr_mustash Yelp s Mission Connecting people with great local businesses. My Database Experience Started using Postgres 7 years ago Postgres 8.4 (released
More informationPartitioning. Sheeri K. Cabral Database Administrator The Pythian Group, January 12, 2009
Partitioning Sheeri K. Cabral Database Administrator The Pythian Group, www.pythian.com cabral@pythian.com January 12, 2009 Partitioning Why What How How to Partition CREATE TABLE tblname ( fld FLDTYPE...
More informationPackage nngeo. September 29, 2018
Type Package Title k-nearest Neighbor Join for Spatial Data Version 0.2.2 Package nngeo September 29, 2018 K-nearest neighbor search for projected and non-projected 'sf' spatial layers. Nearest neighbor
More informationCSE 512 Course Project Operation Requirements
CSE 512 Course Project Operation Requirements 1. Operation Checklist 1) Geometry union 2) Geometry convex hull 3) Geometry farthest pair 4) Geometry closest pair 5) Spatial range query 6) Spatial join
More informationWell Unknown ID AKA EPSG: 3857
Well Unknown ID AKA EPSG: 3857 Pamela Kanu November 2016 WGS 1984 WEB MERCATOR ALIASES: AUXILIARY SPHERE, WKID: 3857, WKID: 102100, WKID: 102113, SHERICAL MERCATOR, WGS 84/PSEUDO-MERCATOR, OPEN LAYERS:
More informationSelect View Approved Hotel List. After Logging In To Your Account:
Select View Approved Hotel List. After Logging In To Your Account: Select Your Search Requirements: Enter your hotel search criteria. You can narrow your search results by choosing any of these options:
More informationPackage geoops. March 19, 2018
Type Package Package geoops March 19, 2018 Title 'GeoJSON' Topology Calculations and Operations Tools for doing calculations and manipulations on 'GeoJSON', a 'geospatial' data interchange format ().
More informationMySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona Percona Technical Webinars 9 May 2018
MySQL Performance Optimization and Troubleshooting with PMM Peter Zaitsev, CEO, Percona Percona Technical Webinars 9 May 2018 Few words about Percona Monitoring and Management (PMM) 100% Free, Open Source
More informationSheeri Cabral. Are You Getting the Best Out of Your MySQL Indexes? Slides
Are You Getting the Best Out of Your MySQL Indexes? Slides http://bit.ly/mysqlindex2 Sheeri Cabral Senior DB Admin/Architect, Mozilla @sheeri www.sheeri.com What is an index? KEY vs. INDEX KEY = KEY CONSTRAINT
More informationDatabase Systems. phpmyadmin Tutorial
phpmyadmin Tutorial Please begin by logging into your Student Webspace. You will access the Student Webspace by logging into the Campus Common site. Go to the bottom of the page and click on the Go button
More informationUsing GRASS GIS and R
Using GRASS GIS and R Assignment 2 for Spatial Statistics (STAT 946) Adrian Waddell University of Waterloo November 6, 2008 Adrian Waddell (University of Waterloo) GRASS November 6, 2008 1 / 23 What is
More informationData Model and Management
Data Model and Management Ye Zhao and Farah Kamw Outline Urban Data and Availability Urban Trajectory Data Types Data Preprocessing and Data Registration Urban Trajectory Data and Query Model Spatial Database
More informationOpen Source Database Performance Optimization and Monitoring with PMM. Fernando Laudares, Vinicius Grippa, Michael Coburn Percona
Open Source Database Performance Optimization and Monitoring with PMM Fernando Laudares, Vinicius Grippa, Michael Coburn Percona Fernando Laudares 2 Vinicius Grippa 3 Michael Coburn Product Manager for
More informationThe Top 20 Design Tips
The Top 20 Design Tips For MySQL Enterprise Data Architects Ronald Bradford COO PrimeBase Technologies April 2008 Presented Version By: 1.1 Ronald 10.Apr.2008 Bradford 1. Know Your Technology Tools Generics
More informationLecture 19 Query Processing Part 1
CMSC 461, Database Management Systems Spring 2018 Lecture 19 Query Processing Part 1 These slides are based on Database System Concepts 6 th edition book (whereas some quotes and figures are used from
More informationGeodatabases. Dr. Zhang SPRING 2016 GISC /03/2016
Geodatabases Dr. Zhang SPRING 2016 GISC 1401 10/03/2016 Using and making maps Navigating GIS maps Map design Working with spatial data Spatial data infrastructure Interactive maps Map Animations Map layouts
More informationTools and Techniques for Index Design. Bill Karwin, Percona Inc.
Tools and Techniques for Index Design Bill Karwin, Percona Inc. It s About Performance What s the most frequent recommendation in database performance audits? What s the easiest way to speed up SQL queries,
More informationLoad Data Fast! BILL KARWIN PERCONA LIVE OPEN SOURCE DATABASE CONFERENCE 2017
Load Data Fast! BILL KARWIN PERCONA LIVE OPEN SOURCE DATABASE CONFERENCE 2017 Bill Karwin Software developer, consultant, trainer Using MySQL since 2000 Senior Database Architect at SchoolMessenger SQL
More informationContact: Ye Zhao, Professor Phone: Dept. of Computer Science, Kent State University, Ohio 44242
Table of Contents I. Overview... 2 II. Trajectory Datasets and Data Types... 3 III. Data Loading and Processing Guide... 5 IV. Account and Web-based Data Access... 14 V. Visual Analytics Interface... 15
More informationMySQL 5.1 Past, Present and Future MySQL UC 2006 Santa Clara, CA
MySQL 5.1 Past, Present and Future jan@mysql.com MySQL UC 2006 Santa Clara, CA Abstract Last year at the same place MySQL presented the 5.0 release introducing Stored Procedures, Views and Triggers to
More informationMySQL 101. Designing effective schema for InnoDB. Yves Trudeau April 2015
MySQL 101 Designing effective schema for InnoDB Yves Trudeau April 2015 About myself : Yves Trudeau Principal architect at Percona since 2009 With MySQL then Sun, 2007 to 2009 Focus on MySQL HA and distributed
More informationQGIS Workshop Su Zhang and Laura Gleasner 11/15/2018. QGIS Workshop
1. Introduction to QGIS QGIS Workshop QGIS is a free and open source Geographic Information System (GIS). QGIS can help users create, edit, visualize, analyze, and publish geospatial information on various
More informationMySQL Schema Best Practices
MySQL Schema Best Practices 2 Agenda Introduction 3 4 Introduction - Sample Schema Key Considerations 5 Data Types 6 Data Types [root@plive-2017-demo plive_2017]# ls -alh action*.ibd -rw-r-----. 1 mysql
More informationCONVERT. User Guide. Version 1.3.0
CONVERT. User Guide Contents Installation and Activation of Geoverse Convert...1 Introduction... 2 Job Settings... 3 ADDITIONAL OUTPUT FILES 4 Advanced Job Settings... 5 DATA PROCESSING 5 POINT GIS TRANSFORM
More informationMySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona
MySQL Performance Optimization and Troubleshooting with PMM Peter Zaitsev, CEO, Percona In the Presentation Practical approach to deal with some of the common MySQL Issues 2 Assumptions You re looking
More informationVersion 9 User Guide for. Developed for Omnitracs
Version 9 User Guide for Developed for Omnitracs Table of Contents Welcome to CoPilot Truck 4 Driving Screen 4 Driving Menu 5 GO TO MENU: Single Destination Navigation 6 Address 6 My Places 7 Points of
More informationThe Data Journalist Chapter 7 tutorial Geocoding in ArcGIS Desktop
The Data Journalist Chapter 7 tutorial Geocoding in ArcGIS Desktop Summary: In many cases, online geocoding services are all you will need to convert addresses and other location data into geographic data.
More informationEsri and MarkLogic: Location Analytics, Multi-Model Data
Esri and MarkLogic: Location Analytics, Multi-Model Data Ben Conklin, Industry Manager, Defense, Intel and National Security, Esri Anthony Roach, Product Manager, MarkLogic James Kerr, Technical Director,
More informationMatching GPS Records to Digital Map Data: Algorithm Overview and Application
Report 15-UT-033 Matching GPS Records to Digital Map Data: Algorithm Overview and Application Shane B. McLaughlin, Jonathan M. Hankey Submitted: March 3, 2015 i ACKNOWLEDGMENTS The authors of this report
More informationCustom Location Extension
Custom Location Extension User Guide Version 1.4.9 Custom Location Extension User Guide 2 Contents Contents Legal Notices...3 Document Information... 4 Chapter 1: Overview... 5 What is the Custom Location
More informationGeographic Information Systems. using QGIS
Geographic Information Systems using QGIS 1 - INTRODUCTION Generalities A GIS (Geographic Information System) consists of: -Computer hardware -Computer software - Digital Data Generalities GIS softwares
More informationIntroduction to district compactness using QGIS
Introduction to district compactness using QGIS Mira Bernstein, Metric Geometry and Gerrymandering Group Designed for MIT Day of Engagement, April 18, 2017 1) First things first: before the session Download
More informationMarket Insight Geo Mapping User Guide v1.0
Market Insight Geo Mapping v1.0 D&B Market Insight Geo Mapping Manual Version: 1.0 Software Version: System: 2017 Q3 Training (UK) Contents Introduction... 1 Data Structure... 2 How to Login... 3 Map Options...
More informationMap Direct Lite. Quick Start Guide: Search Results 05/14/2018
Map Direct Lite Quick Start Guide: Search Results 05/14/2018 Contents Quick Start Guide: Search Results... 1 Search Results in Map Direct Lite.... 2 Where is the Search Results Panel?... 3 Search Result
More informationModern Development With MySQL
Modern Development With MySQL Nicolas De Rico nicolas.de.rico@oracle.com Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes
More informationUS Geo-Explorer User s Guide. Web:
US Geo-Explorer User s Guide Web: http://usgeoexplorer.org Updated on October 26, 2016 TABLE OF CONTENTS Introduction... 3 1. System Interface... 5 2. Administrative Unit... 7 2.1 Region Selection... 7
More informationIntroduction to Troubleshooting Performance What Affects Query Execution? Sveta Smirnova Principal Support Engineer April, 7, 2016
Introduction to Troubleshooting Performance What Affects Query Execution? Sveta Smirnova Principal Support Engineer April, 7, 2016 Terms of conditions The query Controlling optimizer Concurrency Hardware
More informationThe Hazards of Multi-writing in a Dual-Master Setup
The Hazards of Multi-writing in a Dual-Master Setup Jay Janssen MySQL Consulting Lead November 15th, 2012 Explaining the Problem Rules of the Replication Road A given MySQL instance: Can be both a master
More informationCE 549 Lab 1 - Linking Streamflow Data to a Gauging Station
CE 549 Lab 1 - Linking Streamflow Data to a Gauging Station Prepared by Venkatesh Merwade Lyles School of Civil Engineering, Purdue University vmerwade@purdue.edu January 2018 Objective The objective of
More informationTips from the Trenches Preventing downtime for the over extended DBA. Andrew Moore Senior Remote DBA Percona Managed Services
Tips from the Trenches Preventing downtime for the over extended DBA Andrew Moore Senior Remote DBA Percona Managed Services Your Presenter Andrew Moore @mysqlboy on twitter 1+ year in Manager Services
More informationPackage rmapzen. October 7, 2018
Package rmapzen October 7, 2018 Type Package Title Client for 'Mapzen' and Related Map APIs Version 0.4.1 Maintainer Tarak Shah Provides an interface to 'Mapzen'-based APIs (including
More informationTutorial 1: Finding and Displaying Spatial Data Using ArcGIS
Tutorial 1: Finding and Displaying Spatial Data Using ArcGIS This tutorial will introduce you to the following: Websites where you may browse to find geospatial information Identifying spatial data, usable
More informationThere And Back Again
There And Back Again Databases At Uber Evan Klitzke October 4, 2016 Outline Background MySQL To Postgres Connection Scalability Write Amplification/Replication Miscellaneous Other Things Databases at Uber
More informationLocation, Location, Location
Location, Location, Location Larry Rudolph 1 Outline Positioning Technology GPS and others Location Specifiers Privacy Issues Universal Location On earth, we need three piece of information: latitude,
More informationStored procedures - what is it?
For a long time to suffer with this issue. Literature on the Internet a lot. I had to ask around at different forums, deeper digging in the manual and explain to himself some weird moments. So, short of
More informationReduction of Field Observations
Reduction of Field Observations GNSS/GPS measurements or Latitudes, Longitudes, HAE: We re interested in projected coordinates, e.g., State Plane Survey measurements in a projected coordinate system, on
More information