SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
Partitioning in MySQL 5.1
                                      and onwards

                          Dr. Mikael Ronström, Senior Software Architect
                                            MySQL AB
                                       mikael@mysql.com




Copyright 2005 MySQL AB                                     The World’s Most Popular Open Source Database 1
Why Partitioning?


                   • For Large Tables:
                          •   ”Divide and Conquer”
                          •   Easier maintenance
                          •   Performance improvement for queries
                          •   Control data placement on disk devices
                          •   Control data placement on Cluster nodes
                          •   Preparatory step for Parallel Queries




Copyright 2005 MySQL AB                                   The World’s Most Popular Open Source Database 2
Partitioned Tables

                     • Partitioned Tables are standard MySQL tables
                          – Can be part of all constructs where tables are
                            used
                              – Complex select queries, Stored Procedures,
                                Triggers, Views
                     • Easy to ALTER TABLE into partitioned table
                          – Syntax from CREATE TABLE can also be used
                            in ALTER TABLE
                     • Easy to drop partitioning on a table
                          – ALTER TABLE t1 REMOVE PARTITIONING;




Copyright 2005 MySQL AB                                        The World’s Most Popular Open Source Database 3
Partition Management

                          •   Fast Deletion of entire parts of a table
                          •   Fast reorganisation of one part of a table
                          •   Fast reorganisation of partition boundaries
                          •   Fast adding of new partitions
                          •   Fast split/merge of partitions




Copyright 2005 MySQL AB                            The World’s Most Popular Open Source Database 4
MySQL Partitioning Types

      • Range Partitioning

      • List Partitioning

      • Hash Partitioning

      • Composite Partitioning




Copyright 2005 MySQL AB                  The World’s Most Popular Open Source Database 5
Storage Engines
    • Partition applies to all storage engines
           –   MyISAM
           –   InnoDB
           –   Archive
           –   NDB Cluster
           –   Falcon
    • Exceptions
           – Merge
    • Don’t mix storage engines in one table for now (5.1 limitation)
           – Example:
                  – Archive Engine for really old data (> 10 years)
                  – MyISAM for medium old data (> 1 year)
                  – InnoDB for current data

Copyright 2005 MySQL AB                                          The World’s Most Popular Open Source Database 6
Key Partitioning


                   • Definition
                          – Same as Hash partitioning except that MySQL
                            decides the hash function using the given fields
                   • Benefits
                          – Very good hash function
                          – Tight integration with MySQL Cluster partitioning
                   • Drawbacks
                          – Same as for Hash partitioning




Copyright 2005 MySQL AB                                   The World’s Most Popular Open Source Database 7
LINEAR HASH/KEY partitioning

           • The normal HASH/KEY uses a modulo function to
             spread records => Even distribution of data among
             partitions
           • Also leads to full rebuild of table for ADD/COALESCE
             Partition
           • LINEAR HASH/KEY partitions use an algorithm based
             on linear hashing which means that some partitions will
             have twice as much data as others if the number of
             partitions is not on the form 2 ^ n
           • LINEAR HASH/KEY only requires rebuild of a number
             of the partitions, thus faster partition management at
             the cost of a slight imbalance

Copyright 2005 MySQL AB                         The World’s Most Popular Open Source Database 8
Partition Function
            • PARTITION BY RANGE(f(f1,f2,f3))
            • Partition function must always deliver integer result
              (5.1 limitation)
            • Partition function can contain any number of fields, but
              must contain at least one field
            • If primary key is defined, no fields outside of primary
              key is allowed in partition function
            • Partition function can contain a large variety of
              character functions, date functions and mathematical
              functions
            • If unique key is defined on a table, no fields outside of
              unique key is allowed in partition function (this
              limitation does not exist for tables in MySQL Cluster)

Copyright 2005 MySQL AB                           The World’s Most Popular Open Source Database 9
Partition Options

                     MAX_ROWS
                     MIN_ROWS
                     NODEGROUP (only MySQL Cluster)
                     DATA DIRECTORY (only MyISAM)
                     INDEX DIRECTORY (only MyISAM)
                     COMMENT




Copyright 2005 MySQL AB                     The World’s Most Popular Open Source Database 10
INFORMATION SCHEMA for
                                Partitioning
      • Provides information of:
             – Partition names
             – Where partitions are stored
             – Information about partition types
             – Information about partition functions
             – Number of rows per partition
             – Average row length in partitions
             – Other attributes of partitions (timestamps, …)
      • Support SHOW CREATE TABLE
      • Support SHOW TABLE STATUS
             – Will be displayed as Create option PARTITIONED


Copyright 2005 MySQL AB                                   The World’s Most Popular Open Source Database 11
EXPLAIN for queries using
                             Partitioned Tables

   • Explains which partitions will be actually scanned in a
     query
         – Gives you everything that EXPLAIN provides
         – Plus a list of partition names used in the query
   • Use EXPLAIN PARTITIONS to understand:
         – How partition pruning affects the query
         – Which indexes are used
                • might be affected by partitioning
         – If there is a better partitioning strategy




Copyright 2005 MySQL AB                                 The World’s Most Popular Open Source Database 12
Partition Management

   •    ALTER TABLE t1 DROP PARTITION p0;
   •    ALTER TABLE t1 ADD PARTITION (PARTITION p1);
   •    ALTER TABLE t1 REORGANIZE PARTITION ….;
   •    ALTER TABLE t1 COALESCE PARTITION 1;
   •    ALTER TABLE t1 REBUILD PARTITION p0;
   •    ALTER TABLE t1 OPTIMIZE PARTITION p0;
   •    ALTER TABLE t1 CHECK PARTITION p0;
   •    ALTER TABLE t1 ANALYZE PARTITION p0;
   •    ALTER TABLE t1 REPAIR PARTITION p0;
   •    ALTER TABLE t1 TRUNCATE PARTITION p0;
Copyright 2005 MySQL AB                The World’s Most Popular Open Source Database 13
Drop RANGE/LIST Partition


ALTER TABLE t1 DROP PARTITION 2002




            2002              2003     2004                             2005




Copyright 2005 MySQL AB                       The World’s Most Popular Open Source Database 14
Add RANGE/LIST Partition

          ALTER TABLE t1 ADD PARTITION (PARTITION 2006 VALUES IN (2006));




           2003                2004               2005                   2006
                                                                            2006




Copyright 2005 MySQL AB                              The World’s Most Popular Open Source Database 15
ADD HASH/KEY partition(s)
                          ALTER TABLE t1 ADD PARTITION (PARTITION p4);

                                        Old Partitions


         p1                                  p2                                 p3




        p1                         p2                    p3                     p4


                                        New Partitions

Copyright 2005 MySQL AB                                       The World’s Most Popular Open Source Database 16
ADD LINEAR HASH/KEY
                                         partition(s)
                          ALTER TABLE t1 ADD PARTITION (PARTITION p4);



                                                                                Old Partitions
         p1                   p2            p3




                              p2                             p4               New Partitions




Copyright 2005 MySQL AB                                     The World’s Most Popular Open Source Database 17
COALESCE HASH/KEY partition(s)
                          ALTER TABLE t1 COALESCE PARTITION 1;




                                                                              Old Partitions
         p1               p2            p3            p4




        p1                 p2            p3                                    New Partitions




Copyright 2005 MySQL AB                                 The World’s Most Popular Open Source Database 18
COALESCE LINEAR HASH/KEY
                                 partition(s)

                           ALTER TABLE t1 COALESCE PARTITION 1;

                                                                              Old Partitions

         p1                               p3
                            p2                            p4




                                                 New Partitions
                             p2




Copyright 2005 MySQL AB                                   The World’s Most Popular Open Source Database 19
Using REORGANIZE partition to
                                 SPLIT a partition
                ALTER TABLE t1 REORGANIZE PARTITION 2006_2007 INTO
                     (PARTITION 2006 VALUES LESS THAN (2007),
                     PARTITION 2007 VALUES LESS THAN (2008));


       Before_2002            2002_2003      2004_2005              2006_2007




                                                                           2007
                                            2006




Copyright 2005 MySQL AB                              The World’s Most Popular Open Source Database 20
Using REORGANIZE partition to
                                 MERGE partitions
                ALTER TABLE t1 REORGANIZE PARTITION 2006,2007 INTO
                   (PARTITION 2006_2007 VALUES LESS THAN (2008));




       Before_2004            2004_2005        2006                       2007




                                                                     2006_2007




Copyright 2005 MySQL AB                               The World’s Most Popular Open Source Database 21
Using REORGANIZE partition to
                                 balance partitions
           ALTER TABLE t1 REORGANIZE PARTITION 2006_Q1,2006_Q2 INTO
            (PARTITION 2006_M1_4 VALUES LESS THAN (DATE(’2006-05-01’),
           PARTITION 2006_M_5_8 VALUES LESS THAN (DATE(’2006-09-01’));


       Before_2004             2005          2006_Q1                    2006-Q2




                                                                     2006_M_5_8
                                            2006_M_1_4




Copyright 2005 MySQL AB                                The World’s Most Popular Open Source Database 22
Using REORGANIZE partition to move
                   partitions to new disk device
              ALTER TABLE t1 REORGANIZE PARTITION 2006 INTO
          (PARTITION 2006 DATA DIRECTORY ’/home/user/2006/data_file’
     INDEX DIRECTORY ’/home/user/2006/index_file’ VALUES LESS THAN (2007));


       Before_2004          2005               2006                       2007




                                               2006




Copyright 2005 MySQL AB                               The World’s Most Popular Open Source Database 23
Using REBUILD partition to recreate
                             partition
                          ALTER TABLE t1 REBUILD PARTITION 2006;




       Before_2004                2005             2006                        2007




                                                    2006




Copyright 2005 MySQL AB                                    The World’s Most Popular Open Source Database 24
Partition Pruning

   • Only scan needed partitions
         – Range optimisations for single-field function, YEAR(date) and
           DATE_TO_DAYS(date) functions (RANGE partitioning)
         – Range optimisations for all LIST/HASH/KEY partitions
   • Best use case:
         – Full table scans on non-indexed fields
   • Example:
         – CREATE TABLE t1 (a int, index(a)) PARTITION BY HASH (a)
           partitions 4;
         – CREATE TABLE t2 (a int, index(a));



Copyright 2005 MySQL AB                             The World’s Most Popular Open Source Database 25
Partition Pruning
  SELECT * FROM Cars                             Where PRICE > 9000


      8000-TSU564-1988    7000-SAG293-2004       12000-FBI007-2004
                                                                           1000-YUK333-1981
     11000-YRG213-2005                           21100-GRO293-1956
                                                                          34000-SIE568-2004
     13000-KAR365-2001                           8500-KHO297-2004




      Results
                                         Price
                                         >9000




Copyright 2005 MySQL AB                                              The World’s Most Popular Open Source Database 26
Partition Pruning
 Select *FROM Cars Where PRICE >9000
 and COLOR= Red
      8000-TSU564-1988    7000-SAG293-2004       12000-FBI007-2004
                                                                           1000-YUK333-1981
     11000-YRG213-2005                           21100-GRO293-1956
                                                                          34000-SIE568-2004
     13000-KAR365-2001                           8500-KHO297-2004




      Results
                                         Price
                                         >9000




Copyright 2005 MySQL AB                                              The World’s Most Popular Open Source Database 27
Dynamic Partitioning Pruning
   SELECT * FROM t1, t2 WHERE t2.a = t1.a;

   If t1 is inner loop it is possible to select only one partition in
       each of its scan (one scan per record in outer table t2).

   If t1 is outer loop it has to scan all partitions.

   Explanation: This works since there is an index on ‘a’
     that contains all partitioning fields and this is bound
     for each scan in inner loop

Copyright 2005 MySQL AB                       The World’s Most Popular Open Source Database 28
Partitioning and NULL values

   • NULL values are allowed in partitioning fields
   • If a partitioning function is evaluated where one field is
     NULL the result of the partitioning will be the smallest
     integer
   • This also holds for VALUES IN (NULL) in List partitioned
     tables
   • VALUES LESS THAN (NULL) is not allowed
   • VALUES LESS THAN MAXVALUE will include all
     integers upto the biggest integer


Copyright 2005 MySQL AB                    The World’s Most Popular Open Source Database 29
Partititioning Implementation

                                        TABLE t1 (Abstract table,
                                          frm-file for t1 exists,
                                            Implemented by
                                            Partition handler)
       Partition p1
     Handler Table
  (no frm for partitions)

          MyISAM/
          InnoDB/
         Federated/
            …..




Copyright 2005 MySQL AB                         The World’s Most Popular Open Source Database 30
index_read Algorithm
                                             Handler output

                                         Merge Sort
                                           Part




     Sorted                   Sorted             Sorted             Sorted
  Output stream            Output stream      Output stream      Output stream
 From Partition 1         From Partition 2   From Partition 3   From Partition 4


Copyright 2005 MySQL AB                                         The World’s Most Popular Open Source Database 31
Insert in Partitioning Table



      YELLOW                 GREEN                                BLUE
                                        RED




          Insert

             GOX 123          $ 3000     2001              YELLOW




Copyright 2005 MySQL AB                         The World’s Most Popular Open Source Database 32
Updating Partition



      Yellow              Blue          Red                    Green




  Delete                                                            Insert


                GOX 123    $ 3000    2001     Yellow



                GOX 123     $ 3000   2001     Green



Copyright 2005 MySQL AB                         The World’s Most Popular Open Source Database 33
Partitioning for MySQL Cluster
   • Default for MySQL Cluster:
         – All tables in MySQL Cluster are partitioned
         – Default for an ENGINE=NDB is PARTITION BY KEY()
   • User Defined Partitioning for MySQL Cluster
         – Supports same partitioning types as rest of MySQL (Beta using –new)
         – PARTITION BY KEY is fully integrated with NDB kernel
         – Partitions defined in MySQL mapped to partitions in NDB storage
           engine, thus no extra overhead for many partitions
         – Partitioning makes manual placement of partitions possible
   • NOTE:
         – No support for DROP PARTITION
         – Full table copy is always employed for Partition Management
                • Locks entire table (=> not on-line)
                • More memory resources used
                • More processing resources
Copyright 2005 MySQL AB                                 The World’s Most Popular Open Source Database 34
Cluster: Partitioning Controls
                              Physical Distribution
          •    Accessing relevant partitions only (partition pruning) for a query
               optimizes communication costs
          •    A table no longer has to be distributed on all nodes
          •    Altering the table partitioning can change the physical
               distribution
                – Altering table partitioning is currently done as a copying
                  ALTER TABLE
          •    Node groups can be populated on-line
                – ALTER TABLE account
                    ADD PARTITION (PARTITION P2 NODEGROUP 2)
                – With future support for adding nodes (node groups) on-
                  line, tables can be re-partitioned to populate the added
                  nodes

Copyright 2005 MySQL AB                                  The World’s Most Popular Open Source Database 35
Cluster: Partition by Key
        CREATE TABLE service(user int unsigned,
                                                                    service varchar,
                                                                            parameter
            int)
            PRIMARY KEY (user, service)
            PARTITION BY KEY (user)
            ENGINE=NDBCLUSTER;




  • PARTITION BY KEY enables us to place all user records
    from all tables in the same node group
        – Better locality of access for transactions towards a particular user
  • Default number of partitions in MySQL Cluster == Number
    of nodes in cluster


Copyright 2005 MySQL AB                             The World’s Most Popular Open Source Database 36
Cluster: Default Tables

   • ENGINE=NDB is translated to PARTITION BY KEY()
     ENGINE=NDB
         – PARTITION BY KEY() means by fields in primary key
                • if no primary key exists it means by Hidden Key
               – a unique identifier generated by MySQL for tables
                 without primary keys in MySQL Cluster
         – PARTITION BY KEY() can be used also for non-clustered tables
                • Only partition by primary key (no hidden key stuff)
   • Default number of partitions for non-clustered partitioned
     tables is 1


Copyright 2005 MySQL AB                                    The World’s Most Popular Open Source Database 37
Backup and Restore for partitioned
                      tables in MySQL Cluster

   SCENARIO DESCRIPTION:
   • Backup taken in cluster with 4 node groups
   • Restore performed in cluster with 2 node groups
   • Assume table manually partitioned to be in node group 0
     and 3
   • What can be done for the partition in node group 3?
   • For mysqldump and Cluster Replication the table must
     be created by the user before applying the user
     records/binlog


Copyright 2005 MySQL AB                 The World’s Most Popular Open Source Database 38
Nodegroup maps for ndb_restore

   • Using ndb_restore it is possible to specify a mapping
     between node groups as specified in backup and the
     node groups set up by the restore program.
   • Use parameter --ndb-nodegroup-map ’(3,1)(2,0)’
   • It needs a list of mappings from old nodegroup to new
     nodegroup
   • An old nodegroup map can be mapped to more than one
     nodegroup, in that case mappings are done on a round
     robin basis for those partitions
   • Tables that haven’t explicitly set a nodegroup is not
     affected by this mapping
Copyright 2005 MySQL AB                The World’s Most Popular Open Source Database 39
Future Roadmap
     • Global Indexes
           – Unique indexes fully supported
          Foreign Key support
     •
          Import/Export Partitions to/from other tables
     •
          Even more on-line changes
     •
          Optimised locking/opening of tables
     •
           – Better performance
     • Mix storage engines in one table
           – Example:
                  – Archive Engine for really old data (> 10 years)
                  – MyISAM for medium old data (> 1 year)
                  – InnoDB for current data
     • Enable queries on ”broken” tables
           – Query even when a partition is not available
Copyright 2005 MySQL AB                                     The World’s Most Popular Open Source Database 40
Partitioning Limitations (5.1)

    • Partitioning Function must return integer result
    • All partitions must use the same Storage Engine (with
      same options)
    • Use of a partitioned table => open all partitions
    ⇒Increases response time for partitioned tables with many
      partitions (execution overhead very little)
    • Foreign Keys support is not available for partitioned tables
      (on the roadmap for future release)




Copyright 2005 MySQL AB                       The World’s Most Popular Open Source Database 41
More information on Partitioning

                          • Documentation
                            – http://dev.mysql.com/doc/refman/5.1/en/partitioni
                              ng.html
                          • Blog
                            – http://mikaelronstrom.blogspot.com
                          • Forums
                            – http://forums.mysql.com/list.php?106




Copyright 2005 MySQL AB                             The World’s Most Popular Open Source Database 42
Thank You!

                          Senior Software Architect
                            Dr. Mikael Ronström
                                   MySQL AB


                              mikael@mysql.com




Copyright 2005 MySQL AB                          The World’s Most Popular Open Source Database 43

Contenu connexe

Tendances

My First 100 days with a Cassandra Cluster
My First 100 days with a Cassandra ClusterMy First 100 days with a Cassandra Cluster
My First 100 days with a Cassandra ClusterGustavo Rene Antunez
 
Oracle ACFS High Availability NFS Services (HANFS)
Oracle ACFS High Availability NFS Services (HANFS)Oracle ACFS High Availability NFS Services (HANFS)
Oracle ACFS High Availability NFS Services (HANFS)Anju Garg
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015Alex Zaballa
 
Oracle Flex ASM - What’s New and Best Practices by Jim Williams
Oracle Flex ASM - What’s New and Best Practices by Jim WilliamsOracle Flex ASM - What’s New and Best Practices by Jim Williams
Oracle Flex ASM - What’s New and Best Practices by Jim WilliamsMarkus Michalewicz
 
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...Andrejs Karpovs
 
My First 100 days with a MySQL DBMS
My First 100 days with a MySQL DBMSMy First 100 days with a MySQL DBMS
My First 100 days with a MySQL DBMSGustavo Rene Antunez
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLMorgan Tocker
 
Oracle RAC 11g Release 2 Client Connections
Oracle RAC 11g Release 2 Client ConnectionsOracle RAC 11g Release 2 Client Connections
Oracle RAC 11g Release 2 Client ConnectionsMarkus Michalewicz
 
RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)Gustavo Rene Antunez
 
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingOracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingYury Velikanov
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Ted Wennmark
 
DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)Gustavo Rene Antunez
 
My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)Gustavo Rene Antunez
 
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISP
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISPOptimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISP
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISPSecure-24
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Markus Michalewicz
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database managementLeyi (Kamus) Zhang
 
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 versionOracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 versionMarkus Michalewicz
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle DevelopersRonald Bradford
 

Tendances (20)

My First 100 days with a Cassandra Cluster
My First 100 days with a Cassandra ClusterMy First 100 days with a Cassandra Cluster
My First 100 days with a Cassandra Cluster
 
Oracle ACFS High Availability NFS Services (HANFS)
Oracle ACFS High Availability NFS Services (HANFS)Oracle ACFS High Availability NFS Services (HANFS)
Oracle ACFS High Availability NFS Services (HANFS)
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
 
Oracle Flex ASM - What’s New and Best Practices by Jim Williams
Oracle Flex ASM - What’s New and Best Practices by Jim WilliamsOracle Flex ASM - What’s New and Best Practices by Jim Williams
Oracle Flex ASM - What’s New and Best Practices by Jim Williams
 
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
 
My First 100 days with a MySQL DBMS
My First 100 days with a MySQL DBMSMy First 100 days with a MySQL DBMS
My First 100 days with a MySQL DBMS
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
Oracle RAC 11g Release 2 Client Connections
Oracle RAC 11g Release 2 Client ConnectionsOracle RAC 11g Release 2 Client Connections
Oracle RAC 11g Release 2 Client Connections
 
RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)RMAN in 12c: The Next Generation (WP)
RMAN in 12c: The Next Generation (WP)
 
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingOracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 
DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)
 
My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)
 
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISP
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISPOptimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISP
Optimize and Simplify Oracle 12C RAC using dNFS, ZFS and OISP
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database management
 
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 versionOracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
 
Less09 locking
Less09 lockingLess09 locking
Less09 locking
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle Developers
 

Similaire à Partitioning 20061205

Mysql Fulltext Search 1
Mysql Fulltext Search 1Mysql Fulltext Search 1
Mysql Fulltext Search 1johnymas
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practiceswebhostingguy
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Severalnines
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytWrushabhShirsat3
 
Tagging and Folksonomy Schema Design for Scalability and Performance
Tagging and Folksonomy Schema Design for Scalability and PerformanceTagging and Folksonomy Schema Design for Scalability and Performance
Tagging and Folksonomy Schema Design for Scalability and PerformanceEduard Bondarenko
 
Locality of (p)reference
Locality of (p)referenceLocality of (p)reference
Locality of (p)referenceFromDual GmbH
 
How mysql handles ORDER BY, GROUP BY, and DISTINCT
How mysql handles ORDER BY, GROUP BY, and DISTINCTHow mysql handles ORDER BY, GROUP BY, and DISTINCT
How mysql handles ORDER BY, GROUP BY, and DISTINCTSergey Petrunya
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performancesolarisyougood
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007eLiberatica
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performancexKinAnx
 
Less05 storage
Less05 storageLess05 storage
Less05 storageImran Ali
 
SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3sqlserver.co.il
 
VLDB Administration Strategies
VLDB Administration StrategiesVLDB Administration Strategies
VLDB Administration StrategiesMurilo Miranda
 
8 i locally_mgr_tbsp
8 i locally_mgr_tbsp8 i locally_mgr_tbsp
8 i locally_mgr_tbspAnil Pandey
 
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...VMworld
 

Similaire à Partitioning 20061205 (20)

Mysql Fulltext Search 1
Mysql Fulltext Search 1Mysql Fulltext Search 1
Mysql Fulltext Search 1
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practices
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
Tagging and Folksonomy Schema Design for Scalability and Performance
Tagging and Folksonomy Schema Design for Scalability and PerformanceTagging and Folksonomy Schema Design for Scalability and Performance
Tagging and Folksonomy Schema Design for Scalability and Performance
 
Locality of (p)reference
Locality of (p)referenceLocality of (p)reference
Locality of (p)reference
 
How mysql handles ORDER BY, GROUP BY, and DISTINCT
How mysql handles ORDER BY, GROUP BY, and DISTINCTHow mysql handles ORDER BY, GROUP BY, and DISTINCT
How mysql handles ORDER BY, GROUP BY, and DISTINCT
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Less05 storage
Less05 storageLess05 storage
Less05 storage
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
Bigtable and Dynamo
Bigtable and DynamoBigtable and Dynamo
Bigtable and Dynamo
 
Less07 storage
Less07 storageLess07 storage
Less07 storage
 
SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3
 
VLDB Administration Strategies
VLDB Administration StrategiesVLDB Administration Strategies
VLDB Administration Strategies
 
8 i locally_mgr_tbsp
8 i locally_mgr_tbsp8 i locally_mgr_tbsp
8 i locally_mgr_tbsp
 
Fudcon talk.ppt
Fudcon talk.pptFudcon talk.ppt
Fudcon talk.ppt
 
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
 

Plus de Jeff Hammerbacher (20)

20120223keystone
20120223keystone20120223keystone
20120223keystone
 
20100714accel
20100714accel20100714accel
20100714accel
 
20100608sigmod
20100608sigmod20100608sigmod
20100608sigmod
 
20100513brown
20100513brown20100513brown
20100513brown
 
20100423sage
20100423sage20100423sage
20100423sage
 
20100418sos
20100418sos20100418sos
20100418sos
 
20100301icde
20100301icde20100301icde
20100301icde
 
20100201hplabs
20100201hplabs20100201hplabs
20100201hplabs
 
20100128ebay
20100128ebay20100128ebay
20100128ebay
 
20091203gemini
20091203gemini20091203gemini
20091203gemini
 
20091203gemini
20091203gemini20091203gemini
20091203gemini
 
20091110startup2startup
20091110startup2startup20091110startup2startup
20091110startup2startup
 
20091030nasajpl
20091030nasajpl20091030nasajpl
20091030nasajpl
 
20091027genentech
20091027genentech20091027genentech
20091027genentech
 
Mårten Mickos's presentation "Open Source: Why Freedom Makes a Better Busines...
Mårten Mickos's presentation "Open Source: Why Freedom Makes a Better Busines...Mårten Mickos's presentation "Open Source: Why Freedom Makes a Better Busines...
Mårten Mickos's presentation "Open Source: Why Freedom Makes a Better Busines...
 
20090622 Velocity
20090622 Velocity20090622 Velocity
20090622 Velocity
 
20090422 Www
20090422 Www20090422 Www
20090422 Www
 
20090309berkeley
20090309berkeley20090309berkeley
20090309berkeley
 
20081030linkedin
20081030linkedin20081030linkedin
20081030linkedin
 
20081022cca
20081022cca20081022cca
20081022cca
 

Dernier

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Dernier (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Partitioning 20061205

  • 1. Partitioning in MySQL 5.1 and onwards Dr. Mikael Ronström, Senior Software Architect MySQL AB mikael@mysql.com Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 1
  • 2. Why Partitioning? • For Large Tables: • ”Divide and Conquer” • Easier maintenance • Performance improvement for queries • Control data placement on disk devices • Control data placement on Cluster nodes • Preparatory step for Parallel Queries Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 2
  • 3. Partitioned Tables • Partitioned Tables are standard MySQL tables – Can be part of all constructs where tables are used – Complex select queries, Stored Procedures, Triggers, Views • Easy to ALTER TABLE into partitioned table – Syntax from CREATE TABLE can also be used in ALTER TABLE • Easy to drop partitioning on a table – ALTER TABLE t1 REMOVE PARTITIONING; Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 3
  • 4. Partition Management • Fast Deletion of entire parts of a table • Fast reorganisation of one part of a table • Fast reorganisation of partition boundaries • Fast adding of new partitions • Fast split/merge of partitions Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 4
  • 5. MySQL Partitioning Types • Range Partitioning • List Partitioning • Hash Partitioning • Composite Partitioning Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 5
  • 6. Storage Engines • Partition applies to all storage engines – MyISAM – InnoDB – Archive – NDB Cluster – Falcon • Exceptions – Merge • Don’t mix storage engines in one table for now (5.1 limitation) – Example: – Archive Engine for really old data (> 10 years) – MyISAM for medium old data (> 1 year) – InnoDB for current data Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 6
  • 7. Key Partitioning • Definition – Same as Hash partitioning except that MySQL decides the hash function using the given fields • Benefits – Very good hash function – Tight integration with MySQL Cluster partitioning • Drawbacks – Same as for Hash partitioning Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 7
  • 8. LINEAR HASH/KEY partitioning • The normal HASH/KEY uses a modulo function to spread records => Even distribution of data among partitions • Also leads to full rebuild of table for ADD/COALESCE Partition • LINEAR HASH/KEY partitions use an algorithm based on linear hashing which means that some partitions will have twice as much data as others if the number of partitions is not on the form 2 ^ n • LINEAR HASH/KEY only requires rebuild of a number of the partitions, thus faster partition management at the cost of a slight imbalance Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 8
  • 9. Partition Function • PARTITION BY RANGE(f(f1,f2,f3)) • Partition function must always deliver integer result (5.1 limitation) • Partition function can contain any number of fields, but must contain at least one field • If primary key is defined, no fields outside of primary key is allowed in partition function • Partition function can contain a large variety of character functions, date functions and mathematical functions • If unique key is defined on a table, no fields outside of unique key is allowed in partition function (this limitation does not exist for tables in MySQL Cluster) Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 9
  • 10. Partition Options MAX_ROWS MIN_ROWS NODEGROUP (only MySQL Cluster) DATA DIRECTORY (only MyISAM) INDEX DIRECTORY (only MyISAM) COMMENT Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 10
  • 11. INFORMATION SCHEMA for Partitioning • Provides information of: – Partition names – Where partitions are stored – Information about partition types – Information about partition functions – Number of rows per partition – Average row length in partitions – Other attributes of partitions (timestamps, …) • Support SHOW CREATE TABLE • Support SHOW TABLE STATUS – Will be displayed as Create option PARTITIONED Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 11
  • 12. EXPLAIN for queries using Partitioned Tables • Explains which partitions will be actually scanned in a query – Gives you everything that EXPLAIN provides – Plus a list of partition names used in the query • Use EXPLAIN PARTITIONS to understand: – How partition pruning affects the query – Which indexes are used • might be affected by partitioning – If there is a better partitioning strategy Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 12
  • 13. Partition Management • ALTER TABLE t1 DROP PARTITION p0; • ALTER TABLE t1 ADD PARTITION (PARTITION p1); • ALTER TABLE t1 REORGANIZE PARTITION ….; • ALTER TABLE t1 COALESCE PARTITION 1; • ALTER TABLE t1 REBUILD PARTITION p0; • ALTER TABLE t1 OPTIMIZE PARTITION p0; • ALTER TABLE t1 CHECK PARTITION p0; • ALTER TABLE t1 ANALYZE PARTITION p0; • ALTER TABLE t1 REPAIR PARTITION p0; • ALTER TABLE t1 TRUNCATE PARTITION p0; Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 13
  • 14. Drop RANGE/LIST Partition ALTER TABLE t1 DROP PARTITION 2002 2002 2003 2004 2005 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 14
  • 15. Add RANGE/LIST Partition ALTER TABLE t1 ADD PARTITION (PARTITION 2006 VALUES IN (2006)); 2003 2004 2005 2006 2006 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 15
  • 16. ADD HASH/KEY partition(s) ALTER TABLE t1 ADD PARTITION (PARTITION p4); Old Partitions p1 p2 p3 p1 p2 p3 p4 New Partitions Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 16
  • 17. ADD LINEAR HASH/KEY partition(s) ALTER TABLE t1 ADD PARTITION (PARTITION p4); Old Partitions p1 p2 p3 p2 p4 New Partitions Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 17
  • 18. COALESCE HASH/KEY partition(s) ALTER TABLE t1 COALESCE PARTITION 1; Old Partitions p1 p2 p3 p4 p1 p2 p3 New Partitions Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 18
  • 19. COALESCE LINEAR HASH/KEY partition(s) ALTER TABLE t1 COALESCE PARTITION 1; Old Partitions p1 p3 p2 p4 New Partitions p2 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 19
  • 20. Using REORGANIZE partition to SPLIT a partition ALTER TABLE t1 REORGANIZE PARTITION 2006_2007 INTO (PARTITION 2006 VALUES LESS THAN (2007), PARTITION 2007 VALUES LESS THAN (2008)); Before_2002 2002_2003 2004_2005 2006_2007 2007 2006 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 20
  • 21. Using REORGANIZE partition to MERGE partitions ALTER TABLE t1 REORGANIZE PARTITION 2006,2007 INTO (PARTITION 2006_2007 VALUES LESS THAN (2008)); Before_2004 2004_2005 2006 2007 2006_2007 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 21
  • 22. Using REORGANIZE partition to balance partitions ALTER TABLE t1 REORGANIZE PARTITION 2006_Q1,2006_Q2 INTO (PARTITION 2006_M1_4 VALUES LESS THAN (DATE(’2006-05-01’), PARTITION 2006_M_5_8 VALUES LESS THAN (DATE(’2006-09-01’)); Before_2004 2005 2006_Q1 2006-Q2 2006_M_5_8 2006_M_1_4 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 22
  • 23. Using REORGANIZE partition to move partitions to new disk device ALTER TABLE t1 REORGANIZE PARTITION 2006 INTO (PARTITION 2006 DATA DIRECTORY ’/home/user/2006/data_file’ INDEX DIRECTORY ’/home/user/2006/index_file’ VALUES LESS THAN (2007)); Before_2004 2005 2006 2007 2006 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 23
  • 24. Using REBUILD partition to recreate partition ALTER TABLE t1 REBUILD PARTITION 2006; Before_2004 2005 2006 2007 2006 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 24
  • 25. Partition Pruning • Only scan needed partitions – Range optimisations for single-field function, YEAR(date) and DATE_TO_DAYS(date) functions (RANGE partitioning) – Range optimisations for all LIST/HASH/KEY partitions • Best use case: – Full table scans on non-indexed fields • Example: – CREATE TABLE t1 (a int, index(a)) PARTITION BY HASH (a) partitions 4; – CREATE TABLE t2 (a int, index(a)); Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 25
  • 26. Partition Pruning SELECT * FROM Cars Where PRICE > 9000 8000-TSU564-1988 7000-SAG293-2004 12000-FBI007-2004 1000-YUK333-1981 11000-YRG213-2005 21100-GRO293-1956 34000-SIE568-2004 13000-KAR365-2001 8500-KHO297-2004 Results Price >9000 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 26
  • 27. Partition Pruning Select *FROM Cars Where PRICE >9000 and COLOR= Red 8000-TSU564-1988 7000-SAG293-2004 12000-FBI007-2004 1000-YUK333-1981 11000-YRG213-2005 21100-GRO293-1956 34000-SIE568-2004 13000-KAR365-2001 8500-KHO297-2004 Results Price >9000 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 27
  • 28. Dynamic Partitioning Pruning SELECT * FROM t1, t2 WHERE t2.a = t1.a; If t1 is inner loop it is possible to select only one partition in each of its scan (one scan per record in outer table t2). If t1 is outer loop it has to scan all partitions. Explanation: This works since there is an index on ‘a’ that contains all partitioning fields and this is bound for each scan in inner loop Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 28
  • 29. Partitioning and NULL values • NULL values are allowed in partitioning fields • If a partitioning function is evaluated where one field is NULL the result of the partitioning will be the smallest integer • This also holds for VALUES IN (NULL) in List partitioned tables • VALUES LESS THAN (NULL) is not allowed • VALUES LESS THAN MAXVALUE will include all integers upto the biggest integer Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 29
  • 30. Partititioning Implementation TABLE t1 (Abstract table, frm-file for t1 exists, Implemented by Partition handler) Partition p1 Handler Table (no frm for partitions) MyISAM/ InnoDB/ Federated/ ….. Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 30
  • 31. index_read Algorithm Handler output Merge Sort Part Sorted Sorted Sorted Sorted Output stream Output stream Output stream Output stream From Partition 1 From Partition 2 From Partition 3 From Partition 4 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 31
  • 32. Insert in Partitioning Table YELLOW GREEN BLUE RED Insert GOX 123 $ 3000 2001 YELLOW Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 32
  • 33. Updating Partition Yellow Blue Red Green Delete Insert GOX 123 $ 3000 2001 Yellow GOX 123 $ 3000 2001 Green Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 33
  • 34. Partitioning for MySQL Cluster • Default for MySQL Cluster: – All tables in MySQL Cluster are partitioned – Default for an ENGINE=NDB is PARTITION BY KEY() • User Defined Partitioning for MySQL Cluster – Supports same partitioning types as rest of MySQL (Beta using –new) – PARTITION BY KEY is fully integrated with NDB kernel – Partitions defined in MySQL mapped to partitions in NDB storage engine, thus no extra overhead for many partitions – Partitioning makes manual placement of partitions possible • NOTE: – No support for DROP PARTITION – Full table copy is always employed for Partition Management • Locks entire table (=> not on-line) • More memory resources used • More processing resources Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 34
  • 35. Cluster: Partitioning Controls Physical Distribution • Accessing relevant partitions only (partition pruning) for a query optimizes communication costs • A table no longer has to be distributed on all nodes • Altering the table partitioning can change the physical distribution – Altering table partitioning is currently done as a copying ALTER TABLE • Node groups can be populated on-line – ALTER TABLE account ADD PARTITION (PARTITION P2 NODEGROUP 2) – With future support for adding nodes (node groups) on- line, tables can be re-partitioned to populate the added nodes Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 35
  • 36. Cluster: Partition by Key CREATE TABLE service(user int unsigned, service varchar, parameter int) PRIMARY KEY (user, service) PARTITION BY KEY (user) ENGINE=NDBCLUSTER; • PARTITION BY KEY enables us to place all user records from all tables in the same node group – Better locality of access for transactions towards a particular user • Default number of partitions in MySQL Cluster == Number of nodes in cluster Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 36
  • 37. Cluster: Default Tables • ENGINE=NDB is translated to PARTITION BY KEY() ENGINE=NDB – PARTITION BY KEY() means by fields in primary key • if no primary key exists it means by Hidden Key – a unique identifier generated by MySQL for tables without primary keys in MySQL Cluster – PARTITION BY KEY() can be used also for non-clustered tables • Only partition by primary key (no hidden key stuff) • Default number of partitions for non-clustered partitioned tables is 1 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 37
  • 38. Backup and Restore for partitioned tables in MySQL Cluster SCENARIO DESCRIPTION: • Backup taken in cluster with 4 node groups • Restore performed in cluster with 2 node groups • Assume table manually partitioned to be in node group 0 and 3 • What can be done for the partition in node group 3? • For mysqldump and Cluster Replication the table must be created by the user before applying the user records/binlog Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 38
  • 39. Nodegroup maps for ndb_restore • Using ndb_restore it is possible to specify a mapping between node groups as specified in backup and the node groups set up by the restore program. • Use parameter --ndb-nodegroup-map ’(3,1)(2,0)’ • It needs a list of mappings from old nodegroup to new nodegroup • An old nodegroup map can be mapped to more than one nodegroup, in that case mappings are done on a round robin basis for those partitions • Tables that haven’t explicitly set a nodegroup is not affected by this mapping Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 39
  • 40. Future Roadmap • Global Indexes – Unique indexes fully supported Foreign Key support • Import/Export Partitions to/from other tables • Even more on-line changes • Optimised locking/opening of tables • – Better performance • Mix storage engines in one table – Example: – Archive Engine for really old data (> 10 years) – MyISAM for medium old data (> 1 year) – InnoDB for current data • Enable queries on ”broken” tables – Query even when a partition is not available Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 40
  • 41. Partitioning Limitations (5.1) • Partitioning Function must return integer result • All partitions must use the same Storage Engine (with same options) • Use of a partitioned table => open all partitions ⇒Increases response time for partitioned tables with many partitions (execution overhead very little) • Foreign Keys support is not available for partitioned tables (on the roadmap for future release) Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 41
  • 42. More information on Partitioning • Documentation – http://dev.mysql.com/doc/refman/5.1/en/partitioni ng.html • Blog – http://mikaelronstrom.blogspot.com • Forums – http://forums.mysql.com/list.php?106 Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 42
  • 43. Thank You! Senior Software Architect Dr. Mikael Ronström MySQL AB mikael@mysql.com Copyright 2005 MySQL AB The World’s Most Popular Open Source Database 43