SlideShare a Scribd company logo
1 of 33
know more about MySQL open source database MySQL: Open Source Database 1 Salaria Software Services
Storage engines Schema Normalization Data types Indexes Know more about your SQL queries - Using EXPLAIN  Character set and Collation Resources 2 Salaria Software Services Outline
Generics are inefficient • If you have chosen MySQL, take advantage of its strengths • Having an understanding of the database helps you develop better-performing applications ,[object Object]
than try to fix a slow one after the fact!3 Salaria Software Services Why is it significant for a developerto know MySQL?
Salaria Software Services 4 MySQL Pluggable Storage EngineArchitecture MySQL supports several storage engines that act as handlers for different table types ,[object Object],[object Object]
Concurrency: some have more granular locks than others ,[object Object],• Storage: how the data is stored on disk ,[object Object],• Indexes: b-trees, hash • Memory usage ,[object Object],• Transactions: ,[object Object],6 Salaria Software Services What makes engines different?
“As a developer, what do I need to know about storage engines, without being a MySQL expert?” • Keep in mind the following questions: ,[object Object]
Is the data constantly changing?
Is the data mostly logs (INSERTs)?
requirements for reports?
need for transaction control?7 Salaria Software Services So…
Default MySQL engine • high-speed Query and Insert capability ,[object Object]
updates, deletes use table-level locking, slower• full-text indexing ,[object Object],• Non-transactional, No foreign key support • good choice for : ,[object Object]
Web, data warehousing, logging, auditing8 Salaria Software Services MyISAM Pluggable Storage engine
Transaction-safe and ACID (atomicity, consistency, isolation, durability)compliant ,[object Object],• good query performance, depending on indexes • row-level locking, Multi Version Concurrency Control (MVCC) ,[object Object],– Depending on the isolation level, no locking for SELECT – high concurrency possible • uses more disk space and memory than ISAM • Good for Online transaction processing (OLTP) ,[object Object],9 Salaria Software Services InnoDB Storage engine
Entirely in-memory engine ,[object Object]
Updated Data is not persisted– table loaded on restart  • Hash index used by default • Good for ,[object Object]
"lookup" tables,
calculated table counts,
for caching, temporary tables10 Salaria Software Services Memory Engine
Incredible insert speeds • Great compression rates (zlib)? ,[object Object],• No UPDATEs • Ideal for storing and retrieving large amounts of historical data ,[object Object]
Data that can never be updated11 Salaria Software Services Archive engine
Salaria Software Services 12 Pluggable storage engines offerFlexibility You can use multiple storage engines in a single application ,[object Object],• Choose storage engine that's best for your applications requirements ,[object Object],[object Object]
Basic foundation of performance • Normalization • Data Types ,[object Object],- Smaller tables use less disk, less memory, can give better performance • Indexing ,[object Object],14 Salaria Software Services The schema
Eliminate redundant data: ,[object Object]
 Only store related data in a table
reduces database size and errors15 Salaria Software Services Goal of Normalization
updates are usually faster. ,[object Object],• tables are usually smaller, use less memory, which can give better performance. • better performance for distinct or group by queries 16 Salaria Software Services Normalization
However Normalized database causes joins for queries •  excessively normalized database: ,[object Object],• Normalized better for writes OLTP • De-normalized better for reads , reporting • Real World Mixture: ,[object Object]
Cache selected columns in memory table17 Salaria Software Services taking normalization way too far
Smaller => less disk => less memory => better performance Use the smallest data type possible • The smaller your data types, The more index (and data) can fit into a block of memory, the faster your  queries will be. ,[object Object]
Especially for indexed fields18 Salaria Software Services Data Types: Smaller, smaller, smaller
MySQL has 9 numeric data types ,[object Object],•  Integer: ,[object Object]

More Related Content

What's hot

Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]ITCamp
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL ServerRajesh Gunasundaram
 
Building High Performance MySQL Query Systems and Analytic Applications
Building High Performance MySQL Query Systems and Analytic ApplicationsBuilding High Performance MySQL Query Systems and Analytic Applications
Building High Performance MySQL Query Systems and Analytic ApplicationsCalpont
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's Newdpcobb
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimizationDhani Ahmad
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 noveltiesMSDEVMTL
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning Arno Huetter
 
The thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designThe thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designCalpont
 
Optimization SQL Server for Dynamics AX 2012 R3
Optimization SQL Server for Dynamics AX 2012 R3Optimization SQL Server for Dynamics AX 2012 R3
Optimization SQL Server for Dynamics AX 2012 R3Juan Fabian
 
Data Warehouse Logical Design using Mysql
Data Warehouse Logical Design using MysqlData Warehouse Logical Design using Mysql
Data Warehouse Logical Design using MysqlHAFIZ Islam
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracleTrainings
 
Calculation commands in essbase
Calculation commands in essbaseCalculation commands in essbase
Calculation commands in essbaseShoheb Mohammad
 
12c In Memory Management - Saurabh Gupta
12c In Memory Management - Saurabh Gupta 12c In Memory Management - Saurabh Gupta
12c In Memory Management - Saurabh Gupta pasalapudi123
 
Maximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health CheckMaximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health CheckStoneridge Software
 
Maryna Popova "Deep dive AWS Redshift"
Maryna Popova "Deep dive AWS Redshift"Maryna Popova "Deep dive AWS Redshift"
Maryna Popova "Deep dive AWS Redshift"Lviv Startup Club
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet Singh
 

What's hot (20)

Optimization in essbase
Optimization in essbaseOptimization in essbase
Optimization in essbase
 
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
 
Building High Performance MySQL Query Systems and Analytic Applications
Building High Performance MySQL Query Systems and Analytic ApplicationsBuilding High Performance MySQL Query Systems and Analytic Applications
Building High Performance MySQL Query Systems and Analytic Applications
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimization
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
 
The thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designThe thinking persons guide to data warehouse design
The thinking persons guide to data warehouse design
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Optimization SQL Server for Dynamics AX 2012 R3
Optimization SQL Server for Dynamics AX 2012 R3Optimization SQL Server for Dynamics AX 2012 R3
Optimization SQL Server for Dynamics AX 2012 R3
 
Mysql For Developers
Mysql For DevelopersMysql For Developers
Mysql For Developers
 
SQL Server 2016 BI updates
SQL Server 2016 BI updatesSQL Server 2016 BI updates
SQL Server 2016 BI updates
 
Data Warehouse Logical Design using Mysql
Data Warehouse Logical Design using MysqlData Warehouse Logical Design using Mysql
Data Warehouse Logical Design using Mysql
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance Tuning
 
Calculation commands in essbase
Calculation commands in essbaseCalculation commands in essbase
Calculation commands in essbase
 
12c In Memory Management - Saurabh Gupta
12c In Memory Management - Saurabh Gupta 12c In Memory Management - Saurabh Gupta
12c In Memory Management - Saurabh Gupta
 
Maximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health CheckMaximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health Check
 
Maryna Popova "Deep dive AWS Redshift"
Maryna Popova "Deep dive AWS Redshift"Maryna Popova "Deep dive AWS Redshift"
Maryna Popova "Deep dive AWS Redshift"
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
 

Similar to MySQL: Know more about open Source Database

MySQL: Know more about open Source Database
MySQL: Know more about open Source DatabaseMySQL: Know more about open Source Database
MySQL: Know more about open Source DatabaseMahesh Salaria
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server DatabasesColdFusionConference
 
Amazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Web Services
 
Optimising your Amazon Redshift Cluster for Peak Performance
Optimising your Amazon Redshift Cluster for Peak PerformanceOptimising your Amazon Redshift Cluster for Peak Performance
Optimising your Amazon Redshift Cluster for Peak PerformanceAmazon Web Services
 
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...Amazon Web Services
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best PracticesAmazon Web Services
 
Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Ashnikbiz
 
AWS (Amazon Redshift) presentation
AWS (Amazon Redshift) presentationAWS (Amazon Redshift) presentation
AWS (Amazon Redshift) presentationVolodymyr Rovetskiy
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 
Technical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASAshnikbiz
 
Enterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
Enterprise Data World 2018 - Building Cloud Self-Service Analytical SolutionEnterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
Enterprise Data World 2018 - Building Cloud Self-Service Analytical SolutionDmitry Anoshin
 
MySQL Performance Secrets
MySQL Performance SecretsMySQL Performance Secrets
MySQL Performance SecretsOSSCube
 
high performance databases
high performance databaseshigh performance databases
high performance databasesmahdi_92
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014netmind
 

Similar to MySQL: Know more about open Source Database (20)

MySQL: Know more about open Source Database
MySQL: Know more about open Source DatabaseMySQL: Know more about open Source Database
MySQL: Know more about open Source Database
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server Databases
 
Database storage engines
Database storage enginesDatabase storage engines
Database storage engines
 
Amazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and Optimization
 
Optimising your Amazon Redshift Cluster for Peak Performance
Optimising your Amazon Redshift Cluster for Peak PerformanceOptimising your Amazon Redshift Cluster for Peak Performance
Optimising your Amazon Redshift Cluster for Peak Performance
 
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...
Optimizing Your Amazon Redshift Cluster for Peak Performance - AWS Summit Syd...
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
 
Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus
 
Breaking data
Breaking dataBreaking data
Breaking data
 
AWS (Amazon Redshift) presentation
AWS (Amazon Redshift) presentationAWS (Amazon Redshift) presentation
AWS (Amazon Redshift) presentation
 
Introduction to Amazon Athena
Introduction to Amazon AthenaIntroduction to Amazon Athena
Introduction to Amazon Athena
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overview
 
Technical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPAS
 
Enterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
Enterprise Data World 2018 - Building Cloud Self-Service Analytical SolutionEnterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
Enterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
 
MySQL Performance Secrets
MySQL Performance SecretsMySQL Performance Secrets
MySQL Performance Secrets
 
high performance databases
high performance databaseshigh performance databases
high performance databases
 
25 snowflake
25 snowflake25 snowflake
25 snowflake
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014
 
Nosql data models
Nosql data modelsNosql data models
Nosql data models
 

MySQL: Know more about open Source Database

  • 1. know more about MySQL open source database MySQL: Open Source Database 1 Salaria Software Services
  • 2. Storage engines Schema Normalization Data types Indexes Know more about your SQL queries - Using EXPLAIN Character set and Collation Resources 2 Salaria Software Services Outline
  • 3.
  • 4. than try to fix a slow one after the fact!3 Salaria Software Services Why is it significant for a developerto know MySQL?
  • 5.
  • 6.
  • 7.
  • 8. Is the data constantly changing?
  • 9. Is the data mostly logs (INSERTs)?
  • 11. need for transaction control?7 Salaria Software Services So…
  • 12.
  • 13.
  • 14. Web, data warehousing, logging, auditing8 Salaria Software Services MyISAM Pluggable Storage engine
  • 15.
  • 16.
  • 17.
  • 20. for caching, temporary tables10 Salaria Software Services Memory Engine
  • 21.
  • 22. Data that can never be updated11 Salaria Software Services Archive engine
  • 23.
  • 24.
  • 25.
  • 26. Only store related data in a table
  • 27. reduces database size and errors15 Salaria Software Services Goal of Normalization
  • 28.
  • 29.
  • 30. Cache selected columns in memory table17 Salaria Software Services taking normalization way too far
  • 31.
  • 32. Especially for indexed fields18 Salaria Software Services Data Types: Smaller, smaller, smaller
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. only if there is good selectivity:– % of distinct values in a column • But... each index will slow down INSERT, UPDATE, and DELETE operations 23 Salaria Software Services Indexes
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. Compare strings using a variety of collations
  • 47. Mix strings with different character sets or collations in the same server, the same database, or even the same table
  • 48. Allow specification of character set and collation at any level - Mysql > SET NAMES 'utf8'; - Mysql > SHOW CHARACTER SET 28 Salaria Software Services Character set and Collation
  • 49. Two different character sets cannot have the same collation. Each character set has one collation that is the default collation. For example, the default collation for latin1 is latin1_swedish_ci. The output for “SHOW CHARACTER SET” indicates which collation is the default for each displayed character set. There is a convention for collation names: They start with the name of the character set with which they are associated, they usually include a language name, and they end with _ci (case insensitive), _cs (case sensitive), or _bin (binary). 29 Salaria Software Services Collations have these general characteristics
  • 50. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?phpmysql_query('SET NAMES utf8'); ?> CREATE DATABASE mydatabase DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE TABLE mytable (  mydata VARCHAR(128) NOT NULL) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 30 Salaria Software Services How to handle Unicode (UTF-8)
  • 51. MySQL Forge and the Forge Wiki http://forge.mysql.com/ Planet MySQL http://planetmysql.org/ MySQLDevZone http://dev.mysql.com/ High Performance MySQL book 31 Salaria Software Services Resources
  • 52. ? Open Questions 32 Salaria Software Services
  • 53. Salaria Software Services 33 Thanks and Regards Mahesh Salaria mahesh@salaria.net Salaria Software Services http://salariasoft.com