SlideShare a Scribd company logo
1 of 47
7 Database Mistakes
You are making
Hello!
I am Dave Stokes
MySQL Community Manager
Slides for this talk online at
slideshare.net/davidmstokes
2
1. Backing up data != Safety
I do not care about your cron job, cute scripts, or any of that if what
you backup can not be used!
Backups are vital
Use mysqldump/mysqlpump, Xtrabackup, MySQL Enterprise Backup, etcetera
Async Replication, back up down stream server
LVM Snapshots
Something else in house
DO ALL THE ABOVE AND LOOK FOR MORE!!!
4
But restoration is more vital
Be able to restore:
• Entire server
• Schema
• Table
• Row
And make sure you are not the only one at your company with this knowledge
• Document
• Train
• Practice!!!!
5
Paranoia is not your enemy!
6
Murphy’s
law is
optimistic
And make sure you remember to backup
• Binary logs
• Stored Procedures
• Views
• Admin databases
• Encryption keys
• Configuration files (my.cnf, firewall, etc.)
And store them someplace safe
(minimum two places)
7
What is your company’s record retention policy????!
• Suppose your corporate lawyers ask (or are asked by a court) to show
what data you had on hand five years ago? (copy of data, database,
database software, hardware/software to support)
• Are you subject to the new European rules where may have to ‘forget’
data of individuals? What if the USA gets similar rules?
• Medical/Legal/Research rules?
8
2. Keep on top of software updates
Do not skips updates
Keep your software updated!
• New features
• Bug Fixes
• Security vulnerabilities
Good for your resume!
(ask your local FoxPro
or dBase II professional)
10
And Keep a copy of the server
backup before the upgrade
around (and a copy from right
after the upgrade)
11
3. Monitor
Those who do not study the past will pay heavily for the repeats
“Nobody ever bitches that the
database is running too fast!”
13
Dave’s First Law of Databases
What is your database doing RIGHT NOW?!?!?!?
1. RDMS
a. Queries
b. Logins/connections
c. Index management
d. Analytics
e. Overhead
f. Logging
g. Replication
2. Hardware
A. RAM
B. Buffers
C. Logins
D. Network traffic
E. Logging
F. Paging
G. Disk I/O
H. Overhead
14
Big concept
Does your paycheck and/or the paycheck of your
boss depend on a reliable database? Then make
sure you know what the #%@$ is is doing!!
15
Options
Enterprise Level
MySQL Enterprise Manager, Percona Manager, Solar Winds, etc
- Yes, they cost money
Instance Level
MySQL Workbench
PHPMyAdmin (Say hi to the Script Kiddies)
If you do decide to ‘roll your own’ you are not spending your time wisely. Your
time has value.
16
Options
Enterprise Level
MySQL Enterprise Manager, Percona Manager, Solar Winds, etc
- Yes, they cost money
Instance Level
MySQL Workbench
PHPMyAdmin (Say hi to the Script Kiddies)
If you do decide to ‘roll your own’ you are not spending your time wisely. Your
time has value. If you do roll your own do you do your own dentistry?
17
4. Understand User Authentication
18
MySQL
Authentication is
Promiscuous
It is VERY easy to have the
same username with different
hosts (they are a pair) AND
different permissions for each of
those pairs!
19
Connection flow
• $mysql –u joe –p -> sent to server
• Server checks to see if host is okay to connect
• Server may prompt for authentication string
• User and auth string checked
• Is user over resource limits?
• Connection established -> prompt set to user
20
How you can get different privileges for ‘the same’ account
Joe @ 172.12.10.x
Read, write, update, delete
Joe @ 10.10.x.x
Read, write, update, delete, drop
Joe @ %
Everything!!
21
Joe’s developer account when he
joined the company
Joe’s account for use in the data
center
Joe’s account created at 3AM
fighting problems with legacy
application
How you can get different privileges for ‘the same’ account
Joe @ 172.12.10.x
Read, write, update, delete
Joe @ 10.10.x.x
Read, write, update, delete, drop
Joe @ %
EVERYTHING!!
22
Joe’s developer account when he
joined the company
Joe’s account for use in the data
center
Joe’s account created at 3AM
fighting problems with legacy
application
The Mysql daemon look
for the most generous
match First!!!!
Big concept
So someone guesses Joe’s password is ‘JoeISNumber1’ from outside
the 10.10 and 172.12 networks and ends up with privs for
EVERYTHING!!
23
5. Indexes -> too many, too few
24
Big concept
The cost based optimizer determines the cheapest
way to return the requested data, sort of like a
GPS, based on past query statistics and available
indexes.
And like a GPS it can be fooled
And may not have latest
information.
25
Full Table Scan
A Full Table Scan is when every row
of a table (file) needs to be read to
see if it match the search criteria.
SELECT name
FROM city WHERE
District='Texas';
There is no INDEX on the District
column
26
Index Scan
An index lets you go directly to the
matching record(s).
SELECT name
FROM city WHERE
CountryCode='USA';
There is an INDEX on the
CountryCode column so it does not
need to read all the rows!
27
So let’s index every column!!!!
28
Indexes should be considered a parallel table to your data table.
So each time you add, delete, or modify an indexed column, that parallel table
has to be updated TOO!
That overhead is expensive!!!
And the more options you have for indexes, the more the optimizer has to
consider -- That adds a factorial to the complexity for each possible index
29
Why you do not want to index every column!!
Indexing options
1. Compound indexes use more than one column
a. A Year-Month-Date index works for Y-M-D, Y-M, and Y
b. But not for D or M-D (leftmost only!)
2. For ‘multiple short’ columns, consider hashes
a.SELECT * FROM tbl_name WHERE
hash_col=MD5(CONCAT(val1,val2))
AND col1=val1 AND col2=val2;
1. Optimizer Hints
a. Comments in your query to direct optimizer
b.SELECT /*+ JOIN_ORDER(t1, t2) JOIN_PREFIX(t2, t1) */ ... FROM t1, t2;
30
Indexing options
1. Compound indexes use more than one column
1. A Year-Month-Date index works for Y-M-D, Y-M, and Y
2. But not for D or M-D (leftmost only!)
2. Index prefix of column for wide columns
3. For ‘multiple short’ columns, consider hashes
1. SELECT * FROM tbl_name WHERE
hash_col=MD5(CONCAT(val1,val2))
AND col1=val1 AND col2=val2;
4. Optimizer Hints
1. Comments in your query to direct optimizer
2. SELECT /*+ JOIN_ORDER(t1, t2) JOIN_PREFIX(t2, t1) */ ... FROM t1, t2;
31
Sys Schema -- Performance statistics
You can use MySQL Workbench to access the SYS Schema to see a list of
UNUSED indexes
• Do not look at after a reboot as there will not be enough usage data
collected
• Make sure it is not a rarely used index that is not vital at quarter or
year end
32
Histograms - Like Indexes without the overhead (for some data)
A histogram is an accurate representation of the distribution of numerical
data. For databases, a histogram is an approximation of the data
distribution within a specific column.
33
Creating a histogram
mysql> ANALYZE TABLE customer UPDATE HISTOGRAM ON c_mktsegment WITH 1024 BUCKETS;
+---------------+-----------+----------+---------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------+-----------+----------+---------------------------------------------------------+
| dbt3.customer | histogram | status | Histogram statistics created for column 'c_mktsegment'. |
+---------------+-----------+----------+---------------------------------------------------------+
34
Creating a histogram
mysql> ANALYZE TABLE customer UPDATE HISTOGRAM ON c_mktsegment WITH 1024 BUCKETS;
+---------------+-----------+----------+---------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------+-----------+----------+---------------------------------------------------------+
| dbt3.customer | histogram | status | Histogram statistics created for column 'c_mktsegment'. |
+---------------+-----------+----------+---------------------------------------------------------+
35
Do you know the cardinality of your indexes?
Hit rate?
Active data set size?
Invisible indexes
Invisible indexes make it possible to test the effect of removing an index on
query performance, without making a destructive change that must be
undone should the index turn out to be required. Dropping and re-adding an
index can be expensive for a large table, whereas making it invisible and
visible are fast, in-place operations.
ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE;
ALTER TABLE t1 ALTER INDEX i_idx VISIBLE;
36
6. Learn to Optimize Queries
37
Query optimization is a skill, not a
black art. Even if you use an
ORM (lazy), you need to learn
how to use EXPLAIN and read a
query plan.
38
1. Buy a copy of High Performance MySQL and/or the MySQL 5.0
Certification Guide and read sections on query optimizations
a. Both are dated but valuable
2. Learn to use VISUAL EXPLAIN from MySQL Workbench
3. Read DAILY your slow query log
a. Not all slow queries are bad (monthly report)
b. A query that was running well that now shows up on the slow
query log is BAD
4. Optimize the most frequently run queries FIRST
39
Best ways to learn how to optimize queries
7. Use JSON columns
40
Oracle, SQL Server, MySQL, PostgreSQL* have added JSON data types
● PG actually added two JSON data types
Vendors have added Native JSON data type
Mutability
JSON data type let you have a place
store rapidly evolving or undetermined
data.
JSON Data Types are extremely useful!
Replace many-to-many joins
If you have to do repeated index-
lookup/data-dives for ‘stub’ data
consider refactoring that data into
a JSON column
42
MySQl Document Store
• New API – The X Devapi
• New Protocol
• Allows you to use MySQL as a NoSQL JSON Document Store
• No need to set up relational tables, indexes, or normalize data
• Emphasis on CRUD – can use database before having ‘perfect’
knowledge of the data
• Easily mutable
• Works with relational tables too (mix & match)
43
JSON_Table
THE JSON_TABLE is a function that lets you temporarily turn unstructured JSON
data into a relational table for processing with SQL commands
select country_name,
IndyYear from countryinfo,
json_table(doc,"$" columns
(country_name char(20) path "$.Name",
IndyYear int path "$.IndepYear")) as stuff
where IndyYear > 1992;
+----------------+----------+
| country_name | IndyYear |
+----------------+----------+
| Czech Republic | 1993 |
| Eritrea | 1993 |
| Palau | 1994 |
| Slovakia | 1993 |
+----------------+----------+
44
Generated Columns from JSON data
If you find some of that JSON data is needed to be
used in SQL searches then extract that information
into its own column using a Generated Column
CREATE TABLE stuff
(c JSON,
g INT GENERATED ALWAYS AS (c->"$.id")),
INDEX i (g))
;
45
Please buy my book
If you are interested in using the JSON
data type with MySQL but find the
documentation hard to understand or
are just looking for a compact reference
guide, then you need my book!
46
Thanks
David.stokes @oracle.com
@stoker
elephantdolphin.blogspot.com
slidehsare.net./davidmstokes
47

More Related Content

What's hot

Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk Dave Stokes
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop schmutt
 
Row Level Security in databases advanced edition
Row Level Security in databases advanced editionRow Level Security in databases advanced edition
Row Level Security in databases advanced editionAlexander Tokarev
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
 
Percona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationPercona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationmysqlops
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB OptimizerJongJin Lee
 
Dbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyDbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyFranck Pachot
 
Faceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionFaceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionAlexander Tokarev
 
SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization ChecklistGrant Fritchey
 
Scaling sql server 2014 parallel insert
Scaling sql server 2014 parallel insertScaling sql server 2014 parallel insert
Scaling sql server 2014 parallel insertChris Adkin
 
Myth busters - performance tuning 103 2008
Myth busters - performance tuning 103 2008Myth busters - performance tuning 103 2008
Myth busters - performance tuning 103 2008paulguerin
 
Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?Huy Nguyen
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning Arno Huetter
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
 
Summary of "Google's Big Table" at nosql summer reading in Tokyo
Summary of "Google's Big Table" at nosql summer reading in TokyoSummary of "Google's Big Table" at nosql summer reading in Tokyo
Summary of "Google's Big Table" at nosql summer reading in TokyoCLOUDIAN KK
 
Bigtable
BigtableBigtable
Bigtablenextlib
 
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019Dave Stokes
 

What's hot (18)

Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop
 
Row Level Security in databases advanced edition
Row Level Security in databases advanced editionRow Level Security in databases advanced edition
Row Level Security in databases advanced edition
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
Percona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimizationPercona Live 2012PPT: MySQL Query optimization
Percona Live 2012PPT: MySQL Query optimization
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB Optimizer
 
Dbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyDbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easy
 
Faceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionFaceted search with Oracle InMemory option
Faceted search with Oracle InMemory option
 
SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization Checklist
 
Scaling sql server 2014 parallel insert
Scaling sql server 2014 parallel insertScaling sql server 2014 parallel insert
Scaling sql server 2014 parallel insert
 
Myth busters - performance tuning 103 2008
Myth busters - performance tuning 103 2008Myth busters - performance tuning 103 2008
Myth busters - performance tuning 103 2008
 
Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
 
Summary of "Google's Big Table" at nosql summer reading in Tokyo
Summary of "Google's Big Table" at nosql summer reading in TokyoSummary of "Google's Big Table" at nosql summer reading in Tokyo
Summary of "Google's Big Table" at nosql summer reading in Tokyo
 
Bigtable
BigtableBigtable
Bigtable
 
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
 

Similar to 7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019

Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelDaniel Coupal
 
Boosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsBoosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsMatt Kuklinski
 
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_SummaryHiram Fleitas León
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systemselliando dias
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDenny Lee
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really DoingDave Stokes
 
MongoDB: What, why, when
MongoDB: What, why, whenMongoDB: What, why, when
MongoDB: What, why, whenEugenio Minardi
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesDave Stokes
 
How to Achieve Scale with MongoDB
How to Achieve Scale with MongoDBHow to Achieve Scale with MongoDB
How to Achieve Scale with MongoDBMongoDB
 
Silicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBSilicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBDaniel Coupal
 
Machine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossMachine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossAndrew Flatters
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151xlight
 
Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQLUlf Wendel
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowKevin Kline
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupSaewoong Lee
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018Dave Stokes
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In DepthFabio Fumarola
 

Similar to 7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019 (20)

Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
 
Boosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsBoosting the Performance of your Rails Apps
Boosting the Performance of your Rails Apps
 
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
 
Amazon Redshift Deep Dive
Amazon Redshift Deep Dive Amazon Redshift Deep Dive
Amazon Redshift Deep Dive
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons Learned
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really Doing
 
MongoDB: What, why, when
MongoDB: What, why, whenMongoDB: What, why, when
MongoDB: What, why, when
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL Databases
 
How to Achieve Scale with MongoDB
How to Achieve Scale with MongoDBHow to Achieve Scale with MongoDB
How to Achieve Scale with MongoDB
 
Silicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBSilicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDB
 
Machine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy CrossMachine Learning with ML.NET and Azure - Andy Cross
Machine Learning with ML.NET and Azure - Andy Cross
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151
 
Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQL
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
Taming the shrew Power BI
Taming the shrew Power BITaming the shrew Power BI
Taming the shrew Power BI
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
 

More from Dave Stokes

Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational databaseDave Stokes
 
Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021Dave Stokes
 
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
Php & my sql  - how do pdo, mysq-li, and x devapi do what they doPhp & my sql  - how do pdo, mysq-li, and x devapi do what they do
Php & my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
 
Open Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseOpen Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseDave Stokes
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationDave Stokes
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesDave Stokes
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsDave Stokes
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesDave Stokes
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsDave Stokes
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Dave Stokes
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationDave Stokes
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesDave Stokes
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturesDave Stokes
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreDave Stokes
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDave Stokes
 

More from Dave Stokes (20)

Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
 
Database basics for new-ish developers -- All Things Open October 18th 2021
Database basics for new-ish developers  -- All Things Open October 18th 2021Database basics for new-ish developers  -- All Things Open October 18th 2021
Database basics for new-ish developers -- All Things Open October 18th 2021
 
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
Php & my sql  - how do pdo, mysq-li, and x devapi do what they doPhp & my sql  - how do pdo, mysq-li, and x devapi do what they do
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Open Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational DatabaseOpen Source World June '21 -- JSON Within a Relational Database
Open Source World June '21 -- JSON Within a Relational Database
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
 
Midwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL FeaturesMidwest PHP Presentation - New MSQL Features
Midwest PHP Presentation - New MSQL Features
 
Data Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database AnalyticsData Love Conference - Window Functions for Database Analytics
Data Love Conference - Window Functions for Database Analytics
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
 
Confoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New FeaturesConfoo 2021 -- MySQL New Features
Confoo 2021 -- MySQL New Features
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
 
Discover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQLDiscover The Power of NoSQL + MySQL with MySQL
Discover The Power of NoSQL + MySQL with MySQL
 

Recently uploaded

20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolinonuriaiuzzolino1
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 

Recently uploaded (20)

20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 

7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019

  • 2. Hello! I am Dave Stokes MySQL Community Manager Slides for this talk online at slideshare.net/davidmstokes 2
  • 3. 1. Backing up data != Safety I do not care about your cron job, cute scripts, or any of that if what you backup can not be used!
  • 4. Backups are vital Use mysqldump/mysqlpump, Xtrabackup, MySQL Enterprise Backup, etcetera Async Replication, back up down stream server LVM Snapshots Something else in house DO ALL THE ABOVE AND LOOK FOR MORE!!! 4
  • 5. But restoration is more vital Be able to restore: • Entire server • Schema • Table • Row And make sure you are not the only one at your company with this knowledge • Document • Train • Practice!!!! 5
  • 6. Paranoia is not your enemy! 6 Murphy’s law is optimistic
  • 7. And make sure you remember to backup • Binary logs • Stored Procedures • Views • Admin databases • Encryption keys • Configuration files (my.cnf, firewall, etc.) And store them someplace safe (minimum two places) 7
  • 8. What is your company’s record retention policy????! • Suppose your corporate lawyers ask (or are asked by a court) to show what data you had on hand five years ago? (copy of data, database, database software, hardware/software to support) • Are you subject to the new European rules where may have to ‘forget’ data of individuals? What if the USA gets similar rules? • Medical/Legal/Research rules? 8
  • 9. 2. Keep on top of software updates Do not skips updates
  • 10. Keep your software updated! • New features • Bug Fixes • Security vulnerabilities Good for your resume! (ask your local FoxPro or dBase II professional) 10
  • 11. And Keep a copy of the server backup before the upgrade around (and a copy from right after the upgrade) 11
  • 12. 3. Monitor Those who do not study the past will pay heavily for the repeats
  • 13. “Nobody ever bitches that the database is running too fast!” 13 Dave’s First Law of Databases
  • 14. What is your database doing RIGHT NOW?!?!?!? 1. RDMS a. Queries b. Logins/connections c. Index management d. Analytics e. Overhead f. Logging g. Replication 2. Hardware A. RAM B. Buffers C. Logins D. Network traffic E. Logging F. Paging G. Disk I/O H. Overhead 14
  • 15. Big concept Does your paycheck and/or the paycheck of your boss depend on a reliable database? Then make sure you know what the #%@$ is is doing!! 15
  • 16. Options Enterprise Level MySQL Enterprise Manager, Percona Manager, Solar Winds, etc - Yes, they cost money Instance Level MySQL Workbench PHPMyAdmin (Say hi to the Script Kiddies) If you do decide to ‘roll your own’ you are not spending your time wisely. Your time has value. 16
  • 17. Options Enterprise Level MySQL Enterprise Manager, Percona Manager, Solar Winds, etc - Yes, they cost money Instance Level MySQL Workbench PHPMyAdmin (Say hi to the Script Kiddies) If you do decide to ‘roll your own’ you are not spending your time wisely. Your time has value. If you do roll your own do you do your own dentistry? 17
  • 18. 4. Understand User Authentication 18
  • 19. MySQL Authentication is Promiscuous It is VERY easy to have the same username with different hosts (they are a pair) AND different permissions for each of those pairs! 19
  • 20. Connection flow • $mysql –u joe –p -> sent to server • Server checks to see if host is okay to connect • Server may prompt for authentication string • User and auth string checked • Is user over resource limits? • Connection established -> prompt set to user 20
  • 21. How you can get different privileges for ‘the same’ account Joe @ 172.12.10.x Read, write, update, delete Joe @ 10.10.x.x Read, write, update, delete, drop Joe @ % Everything!! 21 Joe’s developer account when he joined the company Joe’s account for use in the data center Joe’s account created at 3AM fighting problems with legacy application
  • 22. How you can get different privileges for ‘the same’ account Joe @ 172.12.10.x Read, write, update, delete Joe @ 10.10.x.x Read, write, update, delete, drop Joe @ % EVERYTHING!! 22 Joe’s developer account when he joined the company Joe’s account for use in the data center Joe’s account created at 3AM fighting problems with legacy application The Mysql daemon look for the most generous match First!!!!
  • 23. Big concept So someone guesses Joe’s password is ‘JoeISNumber1’ from outside the 10.10 and 172.12 networks and ends up with privs for EVERYTHING!! 23
  • 24. 5. Indexes -> too many, too few 24
  • 25. Big concept The cost based optimizer determines the cheapest way to return the requested data, sort of like a GPS, based on past query statistics and available indexes. And like a GPS it can be fooled And may not have latest information. 25
  • 26. Full Table Scan A Full Table Scan is when every row of a table (file) needs to be read to see if it match the search criteria. SELECT name FROM city WHERE District='Texas'; There is no INDEX on the District column 26
  • 27. Index Scan An index lets you go directly to the matching record(s). SELECT name FROM city WHERE CountryCode='USA'; There is an INDEX on the CountryCode column so it does not need to read all the rows! 27
  • 28. So let’s index every column!!!! 28
  • 29. Indexes should be considered a parallel table to your data table. So each time you add, delete, or modify an indexed column, that parallel table has to be updated TOO! That overhead is expensive!!! And the more options you have for indexes, the more the optimizer has to consider -- That adds a factorial to the complexity for each possible index 29 Why you do not want to index every column!!
  • 30. Indexing options 1. Compound indexes use more than one column a. A Year-Month-Date index works for Y-M-D, Y-M, and Y b. But not for D or M-D (leftmost only!) 2. For ‘multiple short’ columns, consider hashes a.SELECT * FROM tbl_name WHERE hash_col=MD5(CONCAT(val1,val2)) AND col1=val1 AND col2=val2; 1. Optimizer Hints a. Comments in your query to direct optimizer b.SELECT /*+ JOIN_ORDER(t1, t2) JOIN_PREFIX(t2, t1) */ ... FROM t1, t2; 30
  • 31. Indexing options 1. Compound indexes use more than one column 1. A Year-Month-Date index works for Y-M-D, Y-M, and Y 2. But not for D or M-D (leftmost only!) 2. Index prefix of column for wide columns 3. For ‘multiple short’ columns, consider hashes 1. SELECT * FROM tbl_name WHERE hash_col=MD5(CONCAT(val1,val2)) AND col1=val1 AND col2=val2; 4. Optimizer Hints 1. Comments in your query to direct optimizer 2. SELECT /*+ JOIN_ORDER(t1, t2) JOIN_PREFIX(t2, t1) */ ... FROM t1, t2; 31
  • 32. Sys Schema -- Performance statistics You can use MySQL Workbench to access the SYS Schema to see a list of UNUSED indexes • Do not look at after a reboot as there will not be enough usage data collected • Make sure it is not a rarely used index that is not vital at quarter or year end 32
  • 33. Histograms - Like Indexes without the overhead (for some data) A histogram is an accurate representation of the distribution of numerical data. For databases, a histogram is an approximation of the data distribution within a specific column. 33
  • 34. Creating a histogram mysql> ANALYZE TABLE customer UPDATE HISTOGRAM ON c_mktsegment WITH 1024 BUCKETS; +---------------+-----------+----------+---------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------+-----------+----------+---------------------------------------------------------+ | dbt3.customer | histogram | status | Histogram statistics created for column 'c_mktsegment'. | +---------------+-----------+----------+---------------------------------------------------------+ 34
  • 35. Creating a histogram mysql> ANALYZE TABLE customer UPDATE HISTOGRAM ON c_mktsegment WITH 1024 BUCKETS; +---------------+-----------+----------+---------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------+-----------+----------+---------------------------------------------------------+ | dbt3.customer | histogram | status | Histogram statistics created for column 'c_mktsegment'. | +---------------+-----------+----------+---------------------------------------------------------+ 35 Do you know the cardinality of your indexes? Hit rate? Active data set size?
  • 36. Invisible indexes Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. Dropping and re-adding an index can be expensive for a large table, whereas making it invisible and visible are fast, in-place operations. ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE; ALTER TABLE t1 ALTER INDEX i_idx VISIBLE; 36
  • 37. 6. Learn to Optimize Queries 37
  • 38. Query optimization is a skill, not a black art. Even if you use an ORM (lazy), you need to learn how to use EXPLAIN and read a query plan. 38
  • 39. 1. Buy a copy of High Performance MySQL and/or the MySQL 5.0 Certification Guide and read sections on query optimizations a. Both are dated but valuable 2. Learn to use VISUAL EXPLAIN from MySQL Workbench 3. Read DAILY your slow query log a. Not all slow queries are bad (monthly report) b. A query that was running well that now shows up on the slow query log is BAD 4. Optimize the most frequently run queries FIRST 39 Best ways to learn how to optimize queries
  • 40. 7. Use JSON columns 40
  • 41. Oracle, SQL Server, MySQL, PostgreSQL* have added JSON data types ● PG actually added two JSON data types Vendors have added Native JSON data type
  • 42. Mutability JSON data type let you have a place store rapidly evolving or undetermined data. JSON Data Types are extremely useful! Replace many-to-many joins If you have to do repeated index- lookup/data-dives for ‘stub’ data consider refactoring that data into a JSON column 42
  • 43. MySQl Document Store • New API – The X Devapi • New Protocol • Allows you to use MySQL as a NoSQL JSON Document Store • No need to set up relational tables, indexes, or normalize data • Emphasis on CRUD – can use database before having ‘perfect’ knowledge of the data • Easily mutable • Works with relational tables too (mix & match) 43
  • 44. JSON_Table THE JSON_TABLE is a function that lets you temporarily turn unstructured JSON data into a relational table for processing with SQL commands select country_name, IndyYear from countryinfo, json_table(doc,"$" columns (country_name char(20) path "$.Name", IndyYear int path "$.IndepYear")) as stuff where IndyYear > 1992; +----------------+----------+ | country_name | IndyYear | +----------------+----------+ | Czech Republic | 1993 | | Eritrea | 1993 | | Palau | 1994 | | Slovakia | 1993 | +----------------+----------+ 44
  • 45. Generated Columns from JSON data If you find some of that JSON data is needed to be used in SQL searches then extract that information into its own column using a Generated Column CREATE TABLE stuff (c JSON, g INT GENERATED ALWAYS AS (c->"$.id")), INDEX i (g)) ; 45
  • 46. Please buy my book If you are interested in using the JSON data type with MySQL but find the documentation hard to understand or are just looking for a compact reference guide, then you need my book! 46

Editor's Notes

  1. Started with a list of forty things that you could be doing wrong and cull it down to seven
  2. I started programming in FORTRAN on punch cards on a Dec KL-1091 running the Tops-10 Operating system
  3. Just performing backups is not enough