Sunteți pe pagina 1din 56

MySQL for the SQL Server DBA

Mike Frank, Product Manager - Oracle/MySQL


Agenda

• MySQL Overview
• Use Cases
• Comparing Feature Sets
• Tools Overview
• Next Steps

© 2010 Oracle Corporation


2
About MySQL

• 15 years of development
• 14
12Years
millionof Development
active installations
• 750+ Partners
70,000+ downloads each day
• 70K+ Downloads
#3 most Per Day
deployed database
• Up to 90% lower TCO than
proprietary database offerings
Customers across every major operating system, hardware
Customers
vendor,across every industry,
geography, major operating system, hardware
and application type
vendor, geography, industry, and application type

High Performance. Reliable. Easy to Use.

© 2010 Oracle Corporation


3
Industry Leading Customers

Web / Web 2.0 OEM / ISV's

SaaS, Hosting, Cloud Computing Telecommunications Enterprise 2.0

© 2010 Oracle Corporation


4
Why MySQL?

© 2010 Oracle Corporation


5
Why MySQL?

• Lower TCO
• Performance
– “Up to 90% Faster Query Response Times”
• Scalability
– “Up to 16-way x86 Servers”
– “Up to 64-way CMT Servers”
• Reliability
– Up to five 9s with MySQL Cluster
• Ease of Use
– Up and running in 15 minutes
– MySQL Enterprise Monitor
– MySQL Workbench
• Open Source

http://www.mysql.com/why-mysql/benchmarks/
© 2010 Oracle Corporation
6
Popular on Windows

• 45,000 downloads per day for Windows packages


• Server
• Tools
• Connectors

• MySQL Survey 2009


• 66% percent used Windows for development
• 48% deployed on Windows for production

© 2010 Oracle Corporation


7
Lower Total Cost of Ownership

• Compared to SQL Server Enterprise Edition


• Per Server vs Per CPU
• No Upfront Licensing
• Example:
– 6 Servers
– 2 CPUs per Server
– 88% Savings!
• MySQL Enterprise
– 24x7 Production Support
– Enterprise Monitor
– Enterprise Binaries
• MySQL Enterprise Unlimited
– Unlimited Servers at a Low Fixed Cost

© 2010 Oracle Corporation


8
Use Cases/Application Scenarios

© 2010 Oracle Corporation


9
Why MySQL? - Web Infrastructure
1. Google 11. MySpace
2. Facebook 12. Google.co.in
3. Yahoo 13. Twitter
4. YouTube 14. Google.de
5. WIN Live 15. QQ.com
6. Wikipedia 16. Microsoft
7. Blogger 17. Rapidshare
8. MSN 18. Wordpress
9. Baidu.com 19. Google.fr
10. Yahoo.co.jp 20. Google UK

© 2010 Oracle Corporation


10
Why MySQL? – Social Networking
Application

Facebook is a social networking site that


connects people with friends and others who
work, study and live around them.

Key Business Benefit

MySQL has enabled Facebook to grow to over


200 million users.

Why MySQL? Scalability & TCO

“We are one of the largest MySQL web sites in


production. MySQL has been a revolution for
young entrepreneurs.”

Owen Van Natta


Chief Operating Officer
Facebook

© 2010 Oracle Corporation


11
Why MySQL? – High Traffic Web Sites

Application
Wikipedia is one of the top 10 most trafficked
web sites in the world, hosting over 7 million
articles in 200 languages.

Key Business Benefit


MySQL has enabled Wikipedia‟s annual visitors
to grow 50,000 to over 154 million.

Why MySQL? Scalability & TCO


“Wikipedia relies upon MySQL replication to
scale-out their database infrastructure and
accommodate more visitors, more articles and
more contributors.”

© 2010 Oracle Corporation


12
Why MySQL? – Ads, Search & Forums
Application
Craigslist is one of the top 10 sites serving 3 billion
page views / month. MySQL is used for all
dynamic content generation and data
management including classified ads, search,
forums.

Key Business Benefit


In less than 5 years, MySQL enabled craigslist to
grow to 10M unique visitors/month.

Why MySQL? Scalability & TCO


“Craigslist infrastructure could not have handled
the exponential growth in traffic without MySQL.”
Craig Newmark
Founder

© 2010 Oracle Corporation


13
Why MySQL? – Session Management
Application
Real-time personalization platform to display
advertising to more relevant buyers and conduct
more effective merchandizing.
Key Business Benefits
Highly scalable and cost-effective system that
handles all of eBay‟s personalization and session
data needs. Manages 4 billion requests per day
of 50/50 read/write operations.
Why MySQL Enterprise?
Performance: 13,000 TPS on Sun Fire x4100
Scalability: Designed for 10x future growth
Ease of Use: MySQL Enterprise Monitor

Chris Kasten,
Kernel Framework Group, eBay

© 2010 Oracle Corporation


14
Why MySQL? - eCommerce

Application
$800 Million Online Retailer of shoes. Zappos
stocks over 3 million items.
Key Business Benefit
Zappos selected MySQL because it was the
most robust, affordable database software
available at the time.
Why MySQL? Reliability & TCO
"MySQL provides the perfect blend of an
enterprise-level database and a cost-effective
technology solution. In my opinion, MySQL is
the only database we would ever trust to power
the Zappos.com website.“

Kris Ongbongan,
IT Manager

© 2010 Oracle Corporation


15
MySQL Support for Windows

• All current Windows versions…


– Windows XP

– Windows Vista

– Windows Server 2003

– Windows Server 2008

• Minimal additional requirements

• 32 and 64 bit x86 architectures supported

© 2010 Oracle Corporation


16
Getting Started - Installation

• Download: http://dev.mysql.com/downloads/mysql/5.1.html
• Enterprise, Community or Source
• 32 or 64 bit version
• MSI Installer, Zip file or “Essentials”

A Visual Guide to Installing MySQL on Windows:


http://www.mysql.com/why-mysql/white-papers/

Installing MySQL on Windows:


http://dev.mysql.com/doc/refman/5.1/en/windows-installation.html

© 2010 Oracle Corporation


17
MySQL Features

© 2010 Oracle Corporation


18
Storage Engines

http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html

© 2010 Oracle Corporation


19
Storage Engine Characteristics
Feature InnoDB MyISAM NDB Archive Memory

Storage limits 64TB No Yes No Yes


Transactions Yes No Yes No No
Locking granularity Row Table Row Row Table
MVCC snapshot read Yes No No No No
Geospatial support Yes Yes No Yes No
Data caches Yes No Yes No NA
Index caches Yes Yes Yes No NA
Compressed data Yes Yes No Yes No
Storage cost Med Small Med Smallest NA
Memory cost High Low High Low High
Bulk insert speed Med High High Highest High
Replication support Yes Yes Yes Yes Yes
Foreign Key support Yes No No No No

© 2010 Oracle Corporation


20
Storage Engine Characteristics
Feature InnoDB MyISAM NDB Archive Memory

Storage limits 64TB No Yes No Yes


Transactions Yes No Yes No No
Locking granularity Row Table Row Row Table
MVCC snapshot read Yes No No No No
Geospatial support Yes Yes No Yes No
Data caches Yes No Yes No NA
Index caches Yes Yes Yes No NA
Compressed data Yes* Yes No Yes No
Storage cost Med Small Med Smallest NA
Memory cost High Low High Low High
Bulk insert speed Med High High Highest High
Replication support Yes Yes Yes Yes Yes
Foreign Key support Yes No No No No

© 2010 Oracle Corporation


21
What is Replication?
The duplication of data changes to more then one location

Asynchronous Replication

update
customer

Synchronous Replication

update
customer

© 2010 Oracle Corporation


22
MySQL Replication – How it Works?
MySQL Master MySQL Slave

mysqld mysqld

updates updates I/O Thread


selects

Replication relay
binlog

SQL Thread
data

index &
binlogs

binlog data

© 2010 Oracle Corporation


23
Scale-Out Overview
Improve application performance and scalability on an
incremental, as-needed basis by adding multiple replicated
database servers on low-cost commodity hardware.

Read
Scale Out

updates reads

Replication

© 2010 Oracle Corporation


24
Replication Use Cases
Backup Business Intelligence

X
OLTP Data Mart/Warehouse

Scale Out Architectures HA Implementations

X
Search Core Data Replication Slave Farm

© 2010 Oracle Corporation


25
Partitioning

• Increase Performance
• Simplify Data Management
• MySQL Partitioning Schemes
– Range
– Hash
– Key
– List
– Composite (sub-partitions)
• SQL Server (Enterprise Edition only)
– CREATE PARTITION FUNCTION

© 2010 Oracle Corporation


26
Backup Types
• Hot (Online non-blocking)
– Innodb Hot Backup (MySQL Enterprise Backup)
– Backs up without locking InnoDB data, supports MyISAM
– High Performance, Compressed, and Partial backup
– Point-in-time recovery
• Export/Import
– Mysqldump tool
– SELECT…INTO FILE, LOAD DATA INFILE
• Synchronize Near time Copy (Hot swap)
• MySQL Replication
• Warm File Copy
– mysqlhotcopy - only for MyISAM and ARCHIVE tables
• Cold Backup
– File System Copy when server is shutdown.

© 2010 Oracle Corporation


27
MySQL Security Model

• MySQL security is based on Access Control Lists (ACLs)


– Connections
– Queries
– Operations users attempt to perform
• SSL-encrypted connections supported between MySQL
clients and servers

More info about SSL connections:


http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html

© 2010 Oracle Corporation


28
MySQL Privilege System

• Authenticates a user connecting from a given host


and associates the user with privileges such as:
– SELECT
– INSERT
– UPDATE
– DELETE
• Ability to have anonymous users
• Privileges for MySQL-specific functions such as:
– LOAD DATA INFILE
– Administrative operations
– Replication

© 2010 Oracle Corporation


29
Connecting to MySQL

• MySQL client expects connection parameters when


accessing a MySQL server:
– Host where the MySQL server is running
– Username
– Password

sample
connection

© 2010 Oracle Corporation


30
Connecting to MySQL

MySQL considers both your host name and user name


Don‟t assume a user name belongs to the same person
everywhere
For example: bill who connects from 192.168.0.10 is not
necessarily the same user as bill who connects from
192.168.0.11
Note: Wild cards - supports „User1‟@‟%‟ or „User1‟@'%.xyz.com'

bill@192.168.0.10

bill@192.168.0.11

© 2010 Oracle Corporation


31
MSQL sysadmin (sa) = MySQL root
Accounts
• Two accounts are created with a user name of root
• These are super user accounts that can do anything
• The initial root account passwords are blank
• One root account for connecting from the local host
• The other allows connections from any host
• Grant role Sysadmin = grant ALL

© 2010 Oracle Corporation


32
Job/Task Scheduler
• MySQL Event Scheduler
– Built-in scheduler for MySQL jobs
– Ease to use, no need for OS scripts
– One off or recurring/scheduled jobs
• Example: “Reorg tables on Sunday at 1 AM”
– DELIMITER //
– CREATE EVENT OPTIMIZE_TABLES
– ON SCHEDULE EVERY 1 WEEK
– STARTS '2009-03-05 1:00:00'
– ON COMPLETION PRESERVE
– DO
– BEGIN
– OPTIMIZE TABLE test.table1;
– OPTIMIZE TABLE test.table2;
– END
– //

© 2010 Oracle Corporation


33
Clustering/High Availability
• MySQL Replication
• Windows Server 2008 Failover Clustering

A Guide to MySQL for Microsoft Windows Server 2008 Failover Clustering:


http://www.mysql.com/why-mysql/white-papers/

© 2010 Oracle Corporation


34
One to One Datatype Mapping

BIGINT NCHAR
BINARY NVARCHAR
BIT NATIONAL CHAR
CHAR NUMERIC
CHARACTER REAL
DATETIME SMALLINT
DECIMAL TEXT
FLOAT TIMESTAMP
DOUBLE PRECESION TINYINT
INTEGER VARBINARY
VARCHAR

© 2010 Oracle Corporation


35
Equivalent Datatypes

SQL Server MySQL


IDENTITY AUTO_INCREMENT
NTEXT TEXT CHARACTER SET
UTF8
SMALLDATETIME DATETIME
MONEY DECIMAL(19,4)
SMALL MONEY DECIMAL (10,4)
UNIQUEIDENTIFIER BINARY(16)
SYSNAME CHAR(256)

© 2010 Oracle Corporation


36
MySQL Stored Procedures and T-SQL
• Requires the parameter list be within ( )
• Cannot take AS after parameter list
• BEGIN and END pair required if more than one statement
• Every statement terminated by ;
• Variable declarations must come before first non-declare

SQL Server MySQL


CREATE PROCEDURE name CREATE PROCEDURE name (
Param1 type, Param1 type,
Param2 type Param2 type
AS )
Statement1 BEGIN
Statement2 Statement1 ;
Statement2 ;
END ;

© 2010 Oracle Corporation


37
SQL Tuning
• SHOW GLOBAL STATUS
• SHOW INNODB STATUS
• Slow Log
• EXPLAIN
• MySQL Enterprise Monitor w/ Query Analyzer

http://www.mysql.com/trials/

© 2010 Oracle Corporation


38
SQL Server Express - Restrictions

• Restricted to 1 CPU
• Restricted to 1 GB RAM
• Restricted to 4 GB of User Data
• Restricted Log Shipping (Subscriber Only)
• No Partitioning
• No SQL Server Agent
• No SQL Profiler

© 2010 Oracle Corporation


39
MySQL on Windows FYIs
• DTS packages
• OLAP services objects
• Synonyms (SQL 2005)
• DDL and Statement-Based Triggers (MySQL has Row-Based)
• Limited Number of Ports
• Concurrent reads
• Blocking read
• ALTER & DROP TABLE
• DATA and INDEX DIRECTORY
• DROP DATABASE
• Case-insensitive names
• Directory and file names
• “Access denied for user”
• “too many connections”

http://dev.mysql.com/doc/refman/5.4/en/windows-vs-unix.html
© 2010 Oracle Corporation
40
Tools & Support

© 2010 Oracle Corporation


41
MySQL Enterprise

• MySQL Enterprise Server


• Monthly Rapid Updates

Server • Quarterly Service Packs

• Hot Fix Program


• Subscription:
• Extended End-of-Life

• MySQL Enterprise
• Global Monitoring License
• of (OEM):
All Servers
• • Embedded Server
Web-Based Central Console
Monitor • Built-in Advisors
• Support
• Expert Advice

• MySQL
Specialized Scale-Out Help Cluster
Carrier-Grade
• • Training
24 x 7 x 365 Production Support
• Web-Based Knowledge Base
• Consulting
Support • Consultative Help
• NRE
• Bug Escalation Program

© 2010 Oracle Corporation


42
MySQL Enterprise Monitor w/ Query Analyzer
• Single, consolidated view into entire MySQL environment
• Auto discovery of MySQL Servers, Replication Topologies
• MySQL Query Analyzer with Visual Correlation Graphs
• Customizable rules-based monitoring and alerts
• Identifies problems before they occur
• Reduces risk of downtime
• Makes it easier
to scale-out without
requiring more DBAs

© 2010 Oracle Corporation


43
Connectors & Visual Studio
• ODBC, JDBC, C++, C….
• Connector/NET
• C#
• ASP.NET
• VB.net
• Connector/Net
• Implements the ADO.NET interfaces
• Integrates into ADO.NET aware tools
• Fully managed ADO.NET driver
• 100% pure C#
• Integrates with Visual Studio
http://www.mysql.com/products/connector

© 2010 Oracle Corporation


44
MySQL Workbench

• ER Modeling
– Design
– Forward/Reverse Engineering
– Schema Synchronization
– Documentation
• New! Administrator Plugin
– Start/Stop Server
– Account/User Management
– Server Variables
– Server Logs
– Database Objects

http://wb.mysql.com/

© 2010 Oracle Corporation


45
MySQL Migration Toolkit
Schema Migration Toolkit Database

Table Migration Toolkit Table

Index Migration Toolkit Index

View Migration Toolkit View

Stored Stored
Procedure manual Procedure

Function manual Function

Trigger manual Trigger

http://dev.mysql.com/downloads/gui-tools/5.0.html

© 2010 Oracle Corporation


46
Next Steps

© 2010 Oracle Corporation


47
MySQL on Windows Resources
• Product Downloads
• Whitepapers
• Visual Guides
• How-Tos
• Upcoming Webinars
• Developer Articles
• Visual Studio Articles
• Archived Webinar Playbacks
• Archived Webinar Slides
• User Forums

http://www.mysql.com/windows/
© 2010 Oracle Corporation
48
Additional Migration Notes

© 2010 Oracle Corporation


49
Recommended Datatype Mappings

© 2010 Oracle Corporation


50
Function Mappings

© 2010 Oracle Corporation


51
Next Steps

© 2010 Oracle Corporation


52
MySQL Enterprise
Enterprise software & services delivered in an annual subscription

• MySQL Enterprise Server


• Monthly Rapid Updates
Database • Quarterly Service Packs
• Hot Fix Program
• Subscription:
• Indemnification
• MySQL Enterprise
• Global Monitoring• License (OEM):
of All Servers
• Embedded Server
• Web-Based Central Console
Monitoring • Built-in Advisors, Expert Advice
• Support
• Problem Query Detection/Analysis
• MySQL
• Specialized Scale-Out Help Cluster
Carrier-Grade
• Online Self help •Knowledge
TrainingBase
Support • Consulting
• 24 x 7 x 365 Problem Resolution
• Consultative Help
• NRE
• High Availability and Scale Out

© 2010 Oracle Corporation


53
MySQL Enterprise Monitor
• Single, consolidated view
into entire MySQL
environment
• Auto-discovery of MySQL
servers, replication
topologies
• Customizable rules-based
monitoring and alerts
• Identifies problems before
they occur
• Reduces risk of downtime
A Virtual MySQL DBA Assistant!
• Makes it easier to scale out
without requiring more DBAs

© 2010 Oracle Corporation


54
MySQL Query Analyzer

• Improve performance by
finding and fixing problem
queries
• Centralized monitoring of
queries across all servers
• Aggregated view of query
execution counts, time, and
rows

© 2010 Oracle Corporation


55
MySQL on Windows Resources
Product Downloads
Whitepapers
Visual Guides
How-Tos
Upcoming Webinars
Developer Articles
Visual Studio Articles
Archived Webinar Playbacks
Archived Webinar Slides
User Forums

http://www.mysql.com/windows/
© 2010 Oracle Corporation
56

S-ar putea să vă placă și