Top 20 Design Tips for MySQL Data Architects

Ronald Bradford
Ronald BradfordPrincipal - Data architecture, performance and scalability for MySQL solutions.
The Top 20 Design Tips


                   The Top 20 Design Tips
                     For MySQL Enterprise Data
                                            Architects




                                         Ronald Bradford
                                                Principal
                                                 42SQL


                                                April 2008
                Presented By: Ronald Bradford
                   Version 1.1 10.Apr.2008                   www.ronaldbradford.com
The Top 20 Design Tips

1. Know Your Technology Tools

❖ Generics are inefficient
❖ Product expertise in a different RDBMS is
  not enough
❖ You have chosen MySQL
 ❖ Maximize it's strengths
 ❖ Minimize it's weaknesses




                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

Overview

❖ Table Structure
❖ SQL
❖ Indexes
❖ Enterprise Approaches




                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

1. Know Your Technology Tools

❖ Maximize MySQL strengths
 ❖ Scale out / HA Options
 ❖ Different Storage Engines
 ❖ Query Cache
❖ Minimize MySQL weaknesses
 ❖ No Online Alter
 ❖ Backup Strategies
 ❖ Instrumentation

                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

2. Know Your Disk Footprint

  Disk = Memory = Performance

❖ Every single byte counts
❖ Average 25% - 30% saving on engagements
❖ Better 60% (200GB System)‫‏‬
❖ Best 78% (8GB per master with 12 masters)‫‏‬

  Less disk accesses and more data in memory
                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type



❖ MySQL has 9 numeric data types
 ❖ Oracle for example has only 1




                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type

❖ Integer:       TINYINT, SMALLINT,
                 MEDIUMINT, INT, BIGINT
❖ Floating Point: FLOAT, DOUBLE
❖ Fixed Point:   DECIMAL
❖ Other:         BIT, (ENUM maybe)‫‏‬




                 Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type

❖ Favorite signs of poor design
 ❖ INT(1)‫‏‬
 ❖ BIGINT AUTO_INCREMENT
 ❖ no UNSIGNED used
 ❖ DECIMAL(31,0)‫‏‬




                  Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type

❖ INT(1) - 1 does not mean 1 digit
 ❖   (1) represents client output display format only
 ❖   INT is 4 Bytes, TINYINT is 1 Byte
 ❖   TINYINT UNSIGNED can store from 0 – 255
 ❖   BIT is even better when values are 0 - 1




                      Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type

❖ BIGINT is not needed for AUTO_INCREMENT
❖ INT UNSIGNED stores 4.3 billion values
 ❖ You should be partitioning when at billions of rows


❖ BIGINT is applicable for some columns
 ❖ e.g. summation of values




                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

3. Choose Your Numeric Data Type
                                                        Best
                                                      Practice
❖ Best Practice
 ❖ All integer columns UNSIGNED unless there is a
   reason otherwise
 ❖ Adds a level of data integrity for negative values




                     Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

4. Other Data Type Efficiencies

❖ TIMESTAMP v DATETIME
 ❖   Suitable for EPOCH only values
 ❖   TIMESTAMP is 4 bytes
 ❖   DATETIME is 8 bytes
 ❖   FYI: DATE is 3 bytes, TIME is 3 bytes = 6 Bytes???




                      Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

4. Other Data Type Efficiencies

❖ CHAR(n)‫‏‬
❖ Use VARCHAR(n) for variable values
❖ e.g. CHAR(128) when storing ~10 bytes




                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

5. Application Data Type Efficiencies

❖ Using Codes or ENUM
 ❖ A description is a presentation layer function
 ❖ e.g. 'M', 'F' instead of 'Male', 'Female'
 ❖ e.g. 'A', 'I' instead of 'Active', 'Inactive'
❖ BINARY(16/20)‫ ‏‬v CHAR(32/40)
 ❖ MD5() or HASH() Hex value with twice the length
❖ INT UNSIGNED for IPv4 address
 ❖ VARCHAR(15) results in average 12 bytes v 4 bytes

                     Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

6. NOT NULL

❖ Saves up to a byte per column per row of data
❖ Double benefit for indexed columns


❖ Don't use frameworks or tools
❖ NOT NULL DEFAULT '' is bad design

                                                      Best
            Always use NOT NULL unless              Practice
              there is a reason why not
                  Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

7. Know about character sets

❖ Default in MySQL 5 is UTF8
❖ Can be defined at database, schema, table
  or column level
❖ Only define columns that need UTF8
 ❖ e.g. Codes, MD5 Value, web address
❖ MySQL internal buffers are fixed width
 ❖ e.g. VARCHAR(255) utf8 is 765 bytes to store just
   1 byte

                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

8. When VARCHAR Is Bad

❖ VARCHAR(255)‫‏‬
 ❖ Poor Design - No understanding of underlying
   data
 ❖ Old Design - ( 4.x limitation, now 3-4 years old)‫‏‬


❖ Disk usage may be efficient
❖ MySQL internal memory usage is not


                      Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

8. When VARCHAR is bad

    CREATE TABLE `XXX` (
  `orderHandle` varchar(255) NOT NULL default '',
  `personName` varchar(255) default NULL,
  `addressLines` varchar(255) default NULL,
  `city` varchar(255) default NULL,
  `state` varchar(255) default NULL,
  `postalCode` varchar(255) default NULL,
  `countryCode` varchar(255) default NULL,
  `phone` varchar(255) default NULL,
  `email` varchar(255) default NULL,
  `shipMethod` varchar(255) default NULL,
  `shipTo` varchar(255) default NULL,
  `receiveByDate` date default NULL,
  `currency` varchar(3) default NULL,
  `price` varchar(255) default NULL,
  `flags` int(11) default '0',
  `lastUpdateTime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `creationTime` timestamp NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY (`orderHandle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8




                                    Presented By: Ronald Bradford                www.ronaldbradford.com
The Top 20 Design Tips

9. Be Wary of TEXT/BLOB

❖ Using SELECT *
 ❖ MySQL Internal Temporary table will force Temp
   Disk Table
❖ Internal storage (e.g. Innodb)‫‏‬
 ❖ Stores first 768 bytes, then a separate 16k data
   page per row per TEXT/BLOB field




                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

10. Know Every SQL Statement
❖ Developers don't write proper SQL statements
❖ SQL statements will directly affect your performance
❖ For Example
 ❖ Repeating SQL statements for no benefit
 ❖ 1000 very quick small unnecessary queries is worse
   then 1 slow query




                     Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

10. Know Every SQL Statement

❖ Data collection options
❖ Incomplete Options
 ❖ Slow Query Log
 ❖ SHOW PROCESSLIST
 ❖ Application level logging
❖ Impractical Options
 ❖ General Log


                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

10. Know Every SQL Statement

❖ Data collection options
 ❖ MySQL Proxy
  ❖ See histogram.lua
  ❖ Firewall forwarding rules




                     Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

11. Monitor Every SQL Statement

❖ Review Query Execution Plan (QEP)‫‏‬
 ❖ EXPLAIN
❖ Time queries
❖ Row Count / Affected rows
❖ Result Set Size                                       Best
                                                      Practice

       Review over time, things change

                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

12. The Impact Of Indexes

❖ Good
 ❖ Dramatic performance improvements
 ❖ Improves memory usage
 ❖ Data Integrity
❖ Bad
 ❖ Slows performance for writes
 ❖ Wastes disk space for unused, duplicate or
   ineffective indexes
 ❖ In-effective usage of memory
                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

13. Index Types For Design

❖ Concatenated Indexes
 ❖ (col1, col2)
❖ Partial Indexes
 ❖ (name(20))
❖ Covering Indexes
❖ Full Text Indexes
❖ No function based indexes

                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

14. Minimizing internal MySQL processing

❖ Correctly design tables, indexes and SQL to
  eliminate
 ❖ Using temporary table
 ❖ Using filesort




                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

15. Transactions

❖ Always design for transactions
❖ Always use transactions
❖ Use a transactional storage engine




                 Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

16. Data Integrity is Key

❖ MySQL historically has been very lax
❖ Warnings (e.g. Truncations) are rarely every
  caught
❖ SQL_MODE=STRICT_ALL_TABLES
❖ Within Schema
 ❖ NOT NULL
 ❖ ENUM
 ❖ UNSIGNED
                  Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

17. Leverage The Query Cache

❖ Query Cache can be a great benefit
❖ Deterministic v Non Deterministic SQL

                                                      Best
                                                    Practice

   MySQL Query Cache is not the only type
      of caching you should consider


                  Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

17. Leverage The Query Cache




                Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

17. Leverage The Query Cache

❖ SHOW PROFILE Path
❖ Simple SELECT
 ❖ No Query Cache 17 steps
 ❖ With Query Cache 5 steps
  ❖ Does not perform parse
  ❖ Does not perform optimize




                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

+--------------------------------+----------+---------------------------+---------------+-------------+
| Status                         | Duration | Source_function           | Source_file   | Source_line |
+--------------------------------+----------+---------------------------+---------------+-------------+
| (initialization)               | 0.000014 | send_result_to_client     | sql_cache.cc |         1143 |
| checking query cache for query | 0.000042 | open_tables               | sql_base.cc   |        2652 |
| Opening tables                 | 0.000015 | mysql_lock_tables         | lock.cc       |          153 |
| System lock                    | 0.000009 | mysql_lock_tables         | lock.cc       |          163 |
| Table lock                     | 0.000034 | mysql_select              | sql_select.cc |        2273 |
| init                           | 0.000041 | optimize                  | sql_select.cc |          765 |
| optimizing                     | 0.000008 | optimize                  | sql_select.cc |          924 |
| statistics                     | 0.000016 | optimize                  | sql_select.cc |          934 |
| preparing                      | 0.000012 | exec                      | sql_select.cc |        1594 |
| executing                      | 0.000008 | exec                      | sql_select.cc |        2114 |
| Sending data                   | 0.000163 | mysql_select              | sql_select.cc |        2318 |
| end                            | 0.000021 | mysql_execute_command     | sql_parse.cc |         5141 |
| query end

| freeing items
| closing tables
                                                     Text
                                 | 0.000007 | query_cache_end_of_result | sql_cache.cc |
| storing result in query cache | 0.000007 | mysql_parse
                                 | 0.000018 | dispatch_command
                                 | 0.000009 | log_slow_statement
                                                                        | sql_parse.cc |
                                                                        | sql_parse.cc |
                                                                        | sql_parse.cc |
                                                                                                   735 |
                                                                                                 6142 |
                                                                                                 2146 |
                                                                                                 2204 |
| logging slow query             | 0.000006 | dispatch_command          | sql_parse.cc |         2169 |
+--------------------------------+----------+---------------------------+---------------+-------------+
17 rows in set (0.00 sec)
+--------------------------------+----------+-----------------------+--------------+-------------+
| Status                         | Duration | Source_function       | Source_file | Source_line |
+--------------------------------+----------+-----------------------+--------------+-------------+
| (initialization)               | 0.000012 | send_result_to_client | sql_cache.cc |        1143 |
| checking query cache for query | 0.00001 | send_result_to_client | sql_cache.cc |         1224 |
| checking privileges on cached | 0.000007 | send_result_to_client | sql_cache.cc |         1317 |
| sending cached result to clien | 0.000025 | log_slow_statement    | sql_parse.cc |        2204 |
| logging slow query             | 0.000007 | dispatch_command      | sql_parse.cc |        2169 |
+--------------------------------+----------+-----------------------+--------------+-------------+
5 rows in set (0.00 sec)




                                              Presented By: Ronald Bradford                       www.ronaldbradford.com
The Top 20 Design Tips

18. Create Objects Appropriately

❖ Using 1 table instead of ʻnʼ for same column
  structure
 ❖ e.g. Code table for each type of code
❖ Splitting tables for optimal storage
 ❖ e.g. Placing optional TEXT/BLOB columns in
   second table
❖ Use permanent tables instead of
  TEMPORARY tables

                    Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

19. Naming Standards

❖ Name all Primary Keyʼs Uniquely
 ❖ e.g. customer_id, order_id not id
❖ Use Data Dictionary SQL to verify data types
 ❖ Data Types & Lengths
❖ Be Descriptive
 ❖ e.g. invoice_date not just date
❖ Avoid Reserved Words
 ❖ e.g. date, time, timestamp

                     Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

20. Testing, Testing, Testing

❖ You must have a testing environment
❖ Testing on a Production server is not an
  option
                                                      Best
                                                    Practice

      The goal of a testing environment
        is not to test your software,
        it is to break your software.
                  Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

Executive Summary

❖ Learn and know MySQL specifics
❖ Disk = Memory = Performance
❖ If you don't know your SQL you don't know
  your application. Log, Review & Monitor all
  SQL
❖ Know all benefits of different indexes
❖ You must test to failure in a dedicated test
  environment
                   Presented By: Ronald Bradford   www.ronaldbradford.com
The Top 20 Design Tips

Professional Help is Available

❖ PrimeBase Technologies
  ❖ Technology Experts
  ❖ Solution Experts


❖ 2 decades Expertise & Experience in
  Enterprise RDBMS Data Architecture
❖ 9 years in MySQL
        www.ronaldbradford.com/contact
                   Presented By: Ronald Bradford   www.ronaldbradford.com
1 of 37

Recommended

Successful Scalability Principles - Part 1 by
Successful Scalability Principles - Part 1Successful Scalability Principles - Part 1
Successful Scalability Principles - Part 1Ronald Bradford
9.8K views94 slides
Extensible Data Modeling by
Extensible Data ModelingExtensible Data Modeling
Extensible Data ModelingKarwin Software Solutions LLC
41.3K views73 slides
Эффективная отладка репликации MySQL by
Эффективная отладка репликации MySQLЭффективная отладка репликации MySQL
Эффективная отладка репликации MySQLSveta Smirnova
13.8K views137 slides
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ... by
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...Frederic Descamps
2.4K views168 slides
MySQL Group Replication by
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationKenny Gryp
6.6K views65 slides
淘宝数据库架构演进历程 by
淘宝数据库架构演进历程淘宝数据库架构演进历程
淘宝数据库架构演进历程zhaolinjnu
5K views42 slides

More Related Content

Viewers also liked

Inno db internals innodb file formats and source code structure by
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structurezhaolinjnu
3.7K views27 slides
MySQL High Availability Solutions by
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
7.2K views41 slides
MySQL Group Replication - HandsOn Tutorial by
MySQL Group Replication - HandsOn TutorialMySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn TutorialKenny Gryp
2.2K views191 slides
MySQL Replication Performance Tuning for Fun and Profit! by
MySQL Replication Performance Tuning for Fun and Profit!MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!Vitor Oliveira
2.9K views63 slides
MySQL InnoDB Cluster - A complete High Availability solution for MySQL by
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLOlivier DASINI
7.4K views73 slides
Mysql参数-GDB by
Mysql参数-GDBMysql参数-GDB
Mysql参数-GDBzhaolinjnu
898 views12 slides

Viewers also liked(20)

Inno db internals innodb file formats and source code structure by zhaolinjnu
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structure
zhaolinjnu3.7K views
MySQL High Availability Solutions by Lenz Grimmer
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
Lenz Grimmer7.2K views
MySQL Group Replication - HandsOn Tutorial by Kenny Gryp
MySQL Group Replication - HandsOn TutorialMySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn Tutorial
Kenny Gryp2.2K views
MySQL Replication Performance Tuning for Fun and Profit! by Vitor Oliveira
MySQL Replication Performance Tuning for Fun and Profit!MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!
Vitor Oliveira2.9K views
MySQL InnoDB Cluster - A complete High Availability solution for MySQL by Olivier DASINI
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI7.4K views
Mysql参数-GDB by zhaolinjnu
Mysql参数-GDBMysql参数-GDB
Mysql参数-GDB
zhaolinjnu898 views
MySQL High Availability with Group Replication by Nuno Carvalho
MySQL High Availability with Group ReplicationMySQL High Availability with Group Replication
MySQL High Availability with Group Replication
Nuno Carvalho3.1K views
Hbase源码初探 by zhaolinjnu
Hbase源码初探Hbase源码初探
Hbase源码初探
zhaolinjnu2.5K views
MySQL aio by zhaolinjnu
MySQL aioMySQL aio
MySQL aio
zhaolinjnu1.8K views
Group Replication: A Journey to the Group Communication Core by Alfranio Júnior
Group Replication: A Journey to the Group Communication CoreGroup Replication: A Journey to the Group Communication Core
Group Replication: A Journey to the Group Communication Core
Alfranio Júnior2.3K views
MySQL Best Practices - OTN LAD Tour by Ronald Bradford
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD Tour
Ronald Bradford9.5K views
Advanced mysql replication techniques by Giuseppe Maxia
Advanced mysql replication techniquesAdvanced mysql replication techniques
Advanced mysql replication techniques
Giuseppe Maxia10.5K views
Capturing, Analyzing and Optimizing MySQL by Ronald Bradford
Capturing, Analyzing and Optimizing MySQLCapturing, Analyzing and Optimizing MySQL
Capturing, Analyzing and Optimizing MySQL
Ronald Bradford5K views
Mysql high availability and scalability by yin gong
Mysql high availability and scalabilityMysql high availability and scalability
Mysql high availability and scalability
yin gong1.8K views
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore by Sujatha Sivakumar
MySQL InnoDB Cluster and Group Replication - OSI 2017 BangaloreMySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
Sujatha Sivakumar593 views
MySQL InnoDB 源码实现分析(一) by frogd
MySQL InnoDB 源码实现分析(一)MySQL InnoDB 源码实现分析(一)
MySQL InnoDB 源码实现分析(一)
frogd7.6K views
Lessons Learned: Troubleshooting Replication by Sveta Smirnova
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
Sveta Smirnova2.3K views
Galera cluster for high availability by Mydbops
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
Mydbops2.2K views
Why MySQL Replication Fails, and How to Get it Back by Sveta Smirnova
Why MySQL Replication Fails, and How to Get it BackWhy MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it Back
Sveta Smirnova2.8K views

More from Ronald Bradford

MySQL Backup and Recovery Essentials by
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsRonald Bradford
11.7K views50 slides
The History and Future of the MySQL ecosystem by
The History and Future of the MySQL ecosystemThe History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystemRonald Bradford
9.1K views60 slides
Lessons Learned Managing Large AWS Environments by
Lessons Learned Managing Large AWS EnvironmentsLessons Learned Managing Large AWS Environments
Lessons Learned Managing Large AWS EnvironmentsRonald Bradford
8K views74 slides
Monitoring your technology stack with New Relic by
Monitoring your technology stack with New RelicMonitoring your technology stack with New Relic
Monitoring your technology stack with New RelicRonald Bradford
15K views100 slides
MySQL Best Practices - OTN by
MySQL Best Practices - OTNMySQL Best Practices - OTN
MySQL Best Practices - OTNRonald Bradford
2.4K views100 slides
MySQL Scalability Mistakes - OTN by
MySQL Scalability Mistakes - OTNMySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTNRonald Bradford
9.2K views79 slides

More from Ronald Bradford(20)

MySQL Backup and Recovery Essentials by Ronald Bradford
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery Essentials
Ronald Bradford11.7K views
The History and Future of the MySQL ecosystem by Ronald Bradford
The History and Future of the MySQL ecosystemThe History and Future of the MySQL ecosystem
The History and Future of the MySQL ecosystem
Ronald Bradford9.1K views
Lessons Learned Managing Large AWS Environments by Ronald Bradford
Lessons Learned Managing Large AWS EnvironmentsLessons Learned Managing Large AWS Environments
Lessons Learned Managing Large AWS Environments
Ronald Bradford8K views
Monitoring your technology stack with New Relic by Ronald Bradford
Monitoring your technology stack with New RelicMonitoring your technology stack with New Relic
Monitoring your technology stack with New Relic
Ronald Bradford15K views
MySQL Scalability Mistakes - OTN by Ronald Bradford
MySQL Scalability Mistakes - OTNMySQL Scalability Mistakes - OTN
MySQL Scalability Mistakes - OTN
Ronald Bradford9.2K views
My SQL Idiosyncrasies That Bite OTN by Ronald Bradford
My SQL Idiosyncrasies That Bite OTNMy SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTN
Ronald Bradford2.9K views
MySQL Idiosyncrasies That Bite 2010.07 by Ronald Bradford
MySQL Idiosyncrasies That Bite 2010.07MySQL Idiosyncrasies That Bite 2010.07
MySQL Idiosyncrasies That Bite 2010.07
Ronald Bradford2.1K views
MySQL Idiosyncrasies That Bite by Ronald Bradford
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That Bite
Ronald Bradford7.6K views
LIFTOFF - MySQLCamp for the Oracle DBA by Ronald Bradford
LIFTOFF - MySQLCamp for the Oracle DBALIFTOFF - MySQLCamp for the Oracle DBA
LIFTOFF - MySQLCamp for the Oracle DBA
Ronald Bradford1.5K views
IGNITION - MySQLCamp for the Oracle DBA by Ronald Bradford
IGNITION - MySQLCamp for the Oracle DBAIGNITION - MySQLCamp for the Oracle DBA
IGNITION - MySQLCamp for the Oracle DBA
Ronald Bradford1.7K views
10x Performance Improvements - A Case Study by Ronald Bradford
10x Performance Improvements - A Case Study10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study
Ronald Bradford13.3K views
Dolphins Now And Beyond - FOSDEM 2010 by Ronald Bradford
Dolphins Now And Beyond - FOSDEM 2010Dolphins Now And Beyond - FOSDEM 2010
Dolphins Now And Beyond - FOSDEM 2010
Ronald Bradford2.2K views
Drizzle - Status, Principles and Ecosystem by Ronald Bradford
Drizzle - Status, Principles and EcosystemDrizzle - Status, Principles and Ecosystem
Drizzle - Status, Principles and Ecosystem
Ronald Bradford1K views
MySQL for the Oracle DBA - Object Management by Ronald Bradford
MySQL for the Oracle DBA - Object ManagementMySQL for the Oracle DBA - Object Management
MySQL for the Oracle DBA - Object Management
Ronald Bradford1.9K views
Know Your Competitor - Oracle 10g Express Edition by Ronald Bradford
Know Your Competitor - Oracle 10g Express EditionKnow Your Competitor - Oracle 10g Express Edition
Know Your Competitor - Oracle 10g Express Edition
Ronald Bradford3.5K views

Recently uploaded

Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericShapeBlue
88 views9 slides
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
146 views15 slides
Data Integrity for Banking and Financial Services by
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
78 views26 slides
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueShapeBlue
93 views15 slides
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPoolShapeBlue
84 views10 slides
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
166 views8 slides

Recently uploaded(20)

Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue88 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue146 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely78 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue93 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue84 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue166 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10126 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue222 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue132 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue176 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu365 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue101 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue98 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue103 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 views

Top 20 Design Tips for MySQL Data Architects

  • 1. The Top 20 Design Tips The Top 20 Design Tips For MySQL Enterprise Data Architects Ronald Bradford Principal 42SQL April 2008 Presented By: Ronald Bradford Version 1.1 10.Apr.2008 www.ronaldbradford.com
  • 2. The Top 20 Design Tips 1. Know Your Technology Tools ❖ Generics are inefficient ❖ Product expertise in a different RDBMS is not enough ❖ You have chosen MySQL ❖ Maximize it's strengths ❖ Minimize it's weaknesses Presented By: Ronald Bradford www.ronaldbradford.com
  • 3. The Top 20 Design Tips Overview ❖ Table Structure ❖ SQL ❖ Indexes ❖ Enterprise Approaches Presented By: Ronald Bradford www.ronaldbradford.com
  • 4. The Top 20 Design Tips 1. Know Your Technology Tools ❖ Maximize MySQL strengths ❖ Scale out / HA Options ❖ Different Storage Engines ❖ Query Cache ❖ Minimize MySQL weaknesses ❖ No Online Alter ❖ Backup Strategies ❖ Instrumentation Presented By: Ronald Bradford www.ronaldbradford.com
  • 5. The Top 20 Design Tips 2. Know Your Disk Footprint Disk = Memory = Performance ❖ Every single byte counts ❖ Average 25% - 30% saving on engagements ❖ Better 60% (200GB System)‫‏‬ ❖ Best 78% (8GB per master with 12 masters)‫‏‬ Less disk accesses and more data in memory Presented By: Ronald Bradford www.ronaldbradford.com
  • 6. The Top 20 Design Tips 3. Choose Your Numeric Data Type ❖ MySQL has 9 numeric data types ❖ Oracle for example has only 1 Presented By: Ronald Bradford www.ronaldbradford.com
  • 7. The Top 20 Design Tips 3. Choose Your Numeric Data Type ❖ Integer: TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT ❖ Floating Point: FLOAT, DOUBLE ❖ Fixed Point: DECIMAL ❖ Other: BIT, (ENUM maybe)‫‏‬ Presented By: Ronald Bradford www.ronaldbradford.com
  • 8. The Top 20 Design Tips 3. Choose Your Numeric Data Type ❖ Favorite signs of poor design ❖ INT(1)‫‏‬ ❖ BIGINT AUTO_INCREMENT ❖ no UNSIGNED used ❖ DECIMAL(31,0)‫‏‬ Presented By: Ronald Bradford www.ronaldbradford.com
  • 9. The Top 20 Design Tips 3. Choose Your Numeric Data Type ❖ INT(1) - 1 does not mean 1 digit ❖ (1) represents client output display format only ❖ INT is 4 Bytes, TINYINT is 1 Byte ❖ TINYINT UNSIGNED can store from 0 – 255 ❖ BIT is even better when values are 0 - 1 Presented By: Ronald Bradford www.ronaldbradford.com
  • 10. The Top 20 Design Tips 3. Choose Your Numeric Data Type ❖ BIGINT is not needed for AUTO_INCREMENT ❖ INT UNSIGNED stores 4.3 billion values ❖ You should be partitioning when at billions of rows ❖ BIGINT is applicable for some columns ❖ e.g. summation of values Presented By: Ronald Bradford www.ronaldbradford.com
  • 11. The Top 20 Design Tips 3. Choose Your Numeric Data Type Best Practice ❖ Best Practice ❖ All integer columns UNSIGNED unless there is a reason otherwise ❖ Adds a level of data integrity for negative values Presented By: Ronald Bradford www.ronaldbradford.com
  • 12. The Top 20 Design Tips 4. Other Data Type Efficiencies ❖ TIMESTAMP v DATETIME ❖ Suitable for EPOCH only values ❖ TIMESTAMP is 4 bytes ❖ DATETIME is 8 bytes ❖ FYI: DATE is 3 bytes, TIME is 3 bytes = 6 Bytes??? Presented By: Ronald Bradford www.ronaldbradford.com
  • 13. The Top 20 Design Tips 4. Other Data Type Efficiencies ❖ CHAR(n)‫‏‬ ❖ Use VARCHAR(n) for variable values ❖ e.g. CHAR(128) when storing ~10 bytes Presented By: Ronald Bradford www.ronaldbradford.com
  • 14. The Top 20 Design Tips 5. Application Data Type Efficiencies ❖ Using Codes or ENUM ❖ A description is a presentation layer function ❖ e.g. 'M', 'F' instead of 'Male', 'Female' ❖ e.g. 'A', 'I' instead of 'Active', 'Inactive' ❖ BINARY(16/20)‫ ‏‬v CHAR(32/40) ❖ MD5() or HASH() Hex value with twice the length ❖ INT UNSIGNED for IPv4 address ❖ VARCHAR(15) results in average 12 bytes v 4 bytes Presented By: Ronald Bradford www.ronaldbradford.com
  • 15. The Top 20 Design Tips 6. NOT NULL ❖ Saves up to a byte per column per row of data ❖ Double benefit for indexed columns ❖ Don't use frameworks or tools ❖ NOT NULL DEFAULT '' is bad design Best Always use NOT NULL unless Practice there is a reason why not Presented By: Ronald Bradford www.ronaldbradford.com
  • 16. The Top 20 Design Tips 7. Know about character sets ❖ Default in MySQL 5 is UTF8 ❖ Can be defined at database, schema, table or column level ❖ Only define columns that need UTF8 ❖ e.g. Codes, MD5 Value, web address ❖ MySQL internal buffers are fixed width ❖ e.g. VARCHAR(255) utf8 is 765 bytes to store just 1 byte Presented By: Ronald Bradford www.ronaldbradford.com
  • 17. The Top 20 Design Tips 8. When VARCHAR Is Bad ❖ VARCHAR(255)‫‏‬ ❖ Poor Design - No understanding of underlying data ❖ Old Design - ( 4.x limitation, now 3-4 years old)‫‏‬ ❖ Disk usage may be efficient ❖ MySQL internal memory usage is not Presented By: Ronald Bradford www.ronaldbradford.com
  • 18. The Top 20 Design Tips 8. When VARCHAR is bad CREATE TABLE `XXX` ( `orderHandle` varchar(255) NOT NULL default '', `personName` varchar(255) default NULL, `addressLines` varchar(255) default NULL, `city` varchar(255) default NULL, `state` varchar(255) default NULL, `postalCode` varchar(255) default NULL, `countryCode` varchar(255) default NULL, `phone` varchar(255) default NULL, `email` varchar(255) default NULL, `shipMethod` varchar(255) default NULL, `shipTo` varchar(255) default NULL, `receiveByDate` date default NULL, `currency` varchar(3) default NULL, `price` varchar(255) default NULL, `flags` int(11) default '0', `lastUpdateTime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `creationTime` timestamp NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`orderHandle`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 Presented By: Ronald Bradford www.ronaldbradford.com
  • 19. The Top 20 Design Tips 9. Be Wary of TEXT/BLOB ❖ Using SELECT * ❖ MySQL Internal Temporary table will force Temp Disk Table ❖ Internal storage (e.g. Innodb)‫‏‬ ❖ Stores first 768 bytes, then a separate 16k data page per row per TEXT/BLOB field Presented By: Ronald Bradford www.ronaldbradford.com
  • 20. The Top 20 Design Tips 10. Know Every SQL Statement ❖ Developers don't write proper SQL statements ❖ SQL statements will directly affect your performance ❖ For Example ❖ Repeating SQL statements for no benefit ❖ 1000 very quick small unnecessary queries is worse then 1 slow query Presented By: Ronald Bradford www.ronaldbradford.com
  • 21. The Top 20 Design Tips 10. Know Every SQL Statement ❖ Data collection options ❖ Incomplete Options ❖ Slow Query Log ❖ SHOW PROCESSLIST ❖ Application level logging ❖ Impractical Options ❖ General Log Presented By: Ronald Bradford www.ronaldbradford.com
  • 22. The Top 20 Design Tips 10. Know Every SQL Statement ❖ Data collection options ❖ MySQL Proxy ❖ See histogram.lua ❖ Firewall forwarding rules Presented By: Ronald Bradford www.ronaldbradford.com
  • 23. The Top 20 Design Tips 11. Monitor Every SQL Statement ❖ Review Query Execution Plan (QEP)‫‏‬ ❖ EXPLAIN ❖ Time queries ❖ Row Count / Affected rows ❖ Result Set Size Best Practice Review over time, things change Presented By: Ronald Bradford www.ronaldbradford.com
  • 24. The Top 20 Design Tips 12. The Impact Of Indexes ❖ Good ❖ Dramatic performance improvements ❖ Improves memory usage ❖ Data Integrity ❖ Bad ❖ Slows performance for writes ❖ Wastes disk space for unused, duplicate or ineffective indexes ❖ In-effective usage of memory Presented By: Ronald Bradford www.ronaldbradford.com
  • 25. The Top 20 Design Tips 13. Index Types For Design ❖ Concatenated Indexes ❖ (col1, col2) ❖ Partial Indexes ❖ (name(20)) ❖ Covering Indexes ❖ Full Text Indexes ❖ No function based indexes Presented By: Ronald Bradford www.ronaldbradford.com
  • 26. The Top 20 Design Tips 14. Minimizing internal MySQL processing ❖ Correctly design tables, indexes and SQL to eliminate ❖ Using temporary table ❖ Using filesort Presented By: Ronald Bradford www.ronaldbradford.com
  • 27. The Top 20 Design Tips 15. Transactions ❖ Always design for transactions ❖ Always use transactions ❖ Use a transactional storage engine Presented By: Ronald Bradford www.ronaldbradford.com
  • 28. The Top 20 Design Tips 16. Data Integrity is Key ❖ MySQL historically has been very lax ❖ Warnings (e.g. Truncations) are rarely every caught ❖ SQL_MODE=STRICT_ALL_TABLES ❖ Within Schema ❖ NOT NULL ❖ ENUM ❖ UNSIGNED Presented By: Ronald Bradford www.ronaldbradford.com
  • 29. The Top 20 Design Tips 17. Leverage The Query Cache ❖ Query Cache can be a great benefit ❖ Deterministic v Non Deterministic SQL Best Practice MySQL Query Cache is not the only type of caching you should consider Presented By: Ronald Bradford www.ronaldbradford.com
  • 30. The Top 20 Design Tips 17. Leverage The Query Cache Presented By: Ronald Bradford www.ronaldbradford.com
  • 31. The Top 20 Design Tips 17. Leverage The Query Cache ❖ SHOW PROFILE Path ❖ Simple SELECT ❖ No Query Cache 17 steps ❖ With Query Cache 5 steps ❖ Does not perform parse ❖ Does not perform optimize Presented By: Ronald Bradford www.ronaldbradford.com
  • 32. The Top 20 Design Tips +--------------------------------+----------+---------------------------+---------------+-------------+ | Status | Duration | Source_function | Source_file | Source_line | +--------------------------------+----------+---------------------------+---------------+-------------+ | (initialization) | 0.000014 | send_result_to_client | sql_cache.cc | 1143 | | checking query cache for query | 0.000042 | open_tables | sql_base.cc | 2652 | | Opening tables | 0.000015 | mysql_lock_tables | lock.cc | 153 | | System lock | 0.000009 | mysql_lock_tables | lock.cc | 163 | | Table lock | 0.000034 | mysql_select | sql_select.cc | 2273 | | init | 0.000041 | optimize | sql_select.cc | 765 | | optimizing | 0.000008 | optimize | sql_select.cc | 924 | | statistics | 0.000016 | optimize | sql_select.cc | 934 | | preparing | 0.000012 | exec | sql_select.cc | 1594 | | executing | 0.000008 | exec | sql_select.cc | 2114 | | Sending data | 0.000163 | mysql_select | sql_select.cc | 2318 | | end | 0.000021 | mysql_execute_command | sql_parse.cc | 5141 | | query end | freeing items | closing tables Text | 0.000007 | query_cache_end_of_result | sql_cache.cc | | storing result in query cache | 0.000007 | mysql_parse | 0.000018 | dispatch_command | 0.000009 | log_slow_statement | sql_parse.cc | | sql_parse.cc | | sql_parse.cc | 735 | 6142 | 2146 | 2204 | | logging slow query | 0.000006 | dispatch_command | sql_parse.cc | 2169 | +--------------------------------+----------+---------------------------+---------------+-------------+ 17 rows in set (0.00 sec) +--------------------------------+----------+-----------------------+--------------+-------------+ | Status | Duration | Source_function | Source_file | Source_line | +--------------------------------+----------+-----------------------+--------------+-------------+ | (initialization) | 0.000012 | send_result_to_client | sql_cache.cc | 1143 | | checking query cache for query | 0.00001 | send_result_to_client | sql_cache.cc | 1224 | | checking privileges on cached | 0.000007 | send_result_to_client | sql_cache.cc | 1317 | | sending cached result to clien | 0.000025 | log_slow_statement | sql_parse.cc | 2204 | | logging slow query | 0.000007 | dispatch_command | sql_parse.cc | 2169 | +--------------------------------+----------+-----------------------+--------------+-------------+ 5 rows in set (0.00 sec) Presented By: Ronald Bradford www.ronaldbradford.com
  • 33. The Top 20 Design Tips 18. Create Objects Appropriately ❖ Using 1 table instead of ʻnʼ for same column structure ❖ e.g. Code table for each type of code ❖ Splitting tables for optimal storage ❖ e.g. Placing optional TEXT/BLOB columns in second table ❖ Use permanent tables instead of TEMPORARY tables Presented By: Ronald Bradford www.ronaldbradford.com
  • 34. The Top 20 Design Tips 19. Naming Standards ❖ Name all Primary Keyʼs Uniquely ❖ e.g. customer_id, order_id not id ❖ Use Data Dictionary SQL to verify data types ❖ Data Types & Lengths ❖ Be Descriptive ❖ e.g. invoice_date not just date ❖ Avoid Reserved Words ❖ e.g. date, time, timestamp Presented By: Ronald Bradford www.ronaldbradford.com
  • 35. The Top 20 Design Tips 20. Testing, Testing, Testing ❖ You must have a testing environment ❖ Testing on a Production server is not an option Best Practice The goal of a testing environment is not to test your software, it is to break your software. Presented By: Ronald Bradford www.ronaldbradford.com
  • 36. The Top 20 Design Tips Executive Summary ❖ Learn and know MySQL specifics ❖ Disk = Memory = Performance ❖ If you don't know your SQL you don't know your application. Log, Review & Monitor all SQL ❖ Know all benefits of different indexes ❖ You must test to failure in a dedicated test environment Presented By: Ronald Bradford www.ronaldbradford.com
  • 37. The Top 20 Design Tips Professional Help is Available ❖ PrimeBase Technologies ❖ Technology Experts ❖ Solution Experts ❖ 2 decades Expertise & Experience in Enterprise RDBMS Data Architecture ❖ 9 years in MySQL www.ronaldbradford.com/contact Presented By: Ronald Bradford www.ronaldbradford.com