SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
Sergei Petrunia
Sergei Golubchik
MariaDB & MySQL community event,
Santa Clara, April 2014
MariaDB 10.0 Optimizer
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:282
MySQL/MariaDB Optimizer history
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:283
MariaDB 5.5
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:284
MySQL 5.6
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:285
MariaDB 10.0
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:286
New features in MariaDB 10.0 Optimizer
● Statistics
●Engine-independent statistics (Histograms)
● Algorithms
●Subquery optimizations: EXISTS-to-IN
● EXPLAIN improvements
●SHOW EXPLAIN
●EXPLAIN in the slow query log
●EXPLAIN for UPDATE/DELETE
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:287
New features in MariaDB 10.0 Optimizer
● Statistics
●Engine-independent statistics (Histograms)
● Algorithms
●Subquery optimizations: EXISTS-to-IN
● EXPLAIN improvements
●SHOW EXPLAIN
●EXPLAIN in the slow query log
●EXPLAIN for UPDATE/DELETE
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:288
Query optimizer needs statistics
select *
from
lineitem, orders
where
o_orderkey=l_orderkey and
o_orderdate between '1990-01-01' and '1998-12-06' and
l_extendedprice > 1000000
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:289
Sources of statistics
● Total number of rows in table
● orders - …
● lineitem -...
● Number of rows that match parts of WHERE
select *
from
lineitem, orders
where
o_orderkey=l_orderkey and
o_orderdate between '1990-01-01' and '1998-12-06' and
l_extendedprice > 1000000;
― “key CMP const” - range condition
―Precise estimates
―Requires an index
―B-Tree index dives
―Expensive to get.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2810
Sources of statistics (2)
where
o_orderkey=l_orderkey and
o_orderdate between '1990-01-01' and '1998-12-06' and
l_extendedprice > 1000000;
● orders.o_orderkey=...
lineitem.l_orderkey=...
● “how many lineitem-s for some $orderkey”?
● Index statistics
● InnoDB
● Random sampling (innodb_stats_sample_pages)
● At “random” times
● MySQL 5.6: persistent statistics
● Still random sampling.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2811
Problems with statistics
● Index statistics: randomness
●Collected via sampling
●Different query plans
●Even for DBT-3 benchmark
●InnoDB Persistent Statistics is a partial solution
● Not index? no statistics
● not_indexed_column= 'foo'
● key_column2= 'bar'.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2812
MariaDB 10.0: Engine independent statistics
● No random sampling
●ANALYZE TABLE makes full table scan
● No auto-updates
●Statistics is deterministic
● More statistics data
●#rows in the table (same)
●Index statistics: cardinality (same)
+Statistics on non-indexed columns
+MIN/MAX values
+Frequency
+#NULL values
+Histograms.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2813
New statistics test run
select *
from
lineitem, orders
where
o_orderkey=l_orderkey and
o_orderdate between '1990-01-01' and '1998-12-06' and
l_extendedprice > 1000000
+--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+
|id|select_type|table |type|possible_keys|key |key_len|ref |rows |filtered|Extra |
+--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+
|1 |SIMPLE |orders |ALL |PRIMARY |NULL |NULL |NULL |1494230| 100.00 |Using where|
|1 |SIMPLE |lineitem|ref |PRIMARY,i_...|PRIMARY|4 |orders.o_orderkey|2 | 100.00 |Using where|
+--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+
● 4.2 seconds
● filtered=100%
● Close to truth for o_orderdate between ...
● Far from truth for l_extendedprice > 1000000.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2814
New statistics test run (2)
set histogram_size=200;
set use_stat_tables='preferably'
analyze table lineitem, orders;
+------------------+---------+----------+-----------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------+---------+----------+-----------------------------------------+
| dbt3sf1.lineitem | analyze | status | Engine-independent statistics collected |
| dbt3sf1.lineitem | analyze | status | OK |
| dbt3sf1.orders | analyze | status | Engine-independent statistics collected |
| dbt3sf1.orders | analyze | status | OK |
+------------------+---------+----------+-----------------------------------------+
set optimizer_use_condition_selectivity=4; .
● Collect table statistics
● Make the optimizer use it
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2815
New statistics test run (3)
+--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+
|id|select_type|table |type |possible_keys|key |key_len|ref |rows |filtered|Extra |
+--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+
|1 |SIMPLE |lineitem|ALL |PRIMARY,i_...|NULL |NULL |NULL |6001215| 0.50 |Using where|
|1 |SIMPLE |orders |eq_ref|PRIMARY |PRIMARY|4 |lineitem.l_orderkey|1 | 99.50 |Using where|
+--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+
select *
from
lineitem, orders
where
o_orderkey=l_orderkey and
o_orderdate between '1990-01-01' and '1998-12-06' and
l_extendedprice > 1000000
● Re-run the query
● lineitem.filtered=0.5% -
● 1.5 sec (from 4.2 sec)
● Can be more for many-table joins.
l_extendedprice > 1000000
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2816
New statistics summary
● Persistent, stable statistics
● Statistics for
● Indexes
● Columns (Histograms)
● Need to enable it and collect manually
1.Collect statistics
2.Make optimizer use it
3.Watch EXPLAIN EXTENDED, filtered%.
set histogram_size=...;
set use_stat_tables='preferably' -- 'complementary'
analyze table tbl [persistent for columns (...) indexes (...)]
set optimizer_use_condition_selectivity = 4;
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2817
Further details
● Documentation update pending
●Will blog
● Percona Live talk today:
●MariaDB Optimizer: See? No indexes!
●4:30PM - 5:20PM @ Ballroom E.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2818
New features in MariaDB 10.0 Optimizer
● Statistics
●Engine-independent statistics (Histograms)
● Algorithms
●Subquery optimizations: EXISTS-to-IN
● EXPLAIN improvements
●SHOW EXPLAIN
●EXPLAIN in the slow query log
●EXPLAIN for UPDATE/DELETE
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2819
Subquery optimizations background
● Traditional way: “straightforward” subquery execution
select * from customer
where
customer.c_acctbal < 0 and
exists (select 1
from orders
where
orders.o_custkey= customer.c_custkey AND
orders.o_orderDATE between $DAY1 and $DAY2)
+--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+
|id|select_type |table |type|possible_keys |key |key_len|ref |rows |Extra |
+--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+
|1 |PRIMARY |customer|ALL |c_acctbal,i_c_acctbal_nationkey|NULL |NULL |NULL |150303|Using where|
|2 |DEPENDENT SUBQUERY|orders |ref |i_o_orderdate,i_o_custkey |i_o_custkey|5 |customer.c_custkey|7 |Using where|
+--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2820
Subquery optimizations background
● Traditional way: “straightforward” subquery execution
select * from customer
where
customer.c_acctbal < 0 and
exists (select 1
from orders
where
orders.o_custkey= customer.c_custkey AND
orders.o_orderDATE between $DAY1 and $DAY2)
● Outer-to-inner execution
● Every subquery re-execution re-runs it from the start
● MariaDB 5.5 added subquery predicate cache.
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2821
MariaDB 5.5, MySQL 5.6
Lots of optimizations for IN (SELECT ...)
● Materialization
● Subquery must be uncorrelated
● Semi-join optimizations
● Both inner-to-outer and outer-to-inner execution
● Materialization
● Join-like execution methods
select * from customer
where
customer.c_acctbal < 0 and
customer.c_custkey IN (select orders.o_custkey
from orders
where
orders.o_orderDATE between ...)
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2822
MariaDB 10.0 – EXISTS subqueries
1.Convert EXISTS into semi-join
select * from customer
where
customer.c_acctbal < 0 and
exists (select 1
from orders
where
orders.o_custkey= customer.c_custkey AND
orders.o_orderDATE between $DAY1 and $DAY2)
Semi-join optimizations
● Both inner-to-outer and outer-to-inner execution
● Join-like execution methods
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2823
MariaDB 10.0 – EXISTS subqueries
2. Convert trivially-correlated EXISTS into IN
EXISTS (select 1
from orders
where
orders.o_custkey=customer.c_custkey AND
orders.o_orderDATE between $DAY1 and $DAY2)
Uncorrelated subquery => can use Materialization
orders.o_custkey IN (select customer.c_custkey
from orders
where
orders.o_orderDATE between $DAY1 and $DAY2)
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2824
EXISTS-to-IN summary
● Enables new subquery optimizations for EXISTS
●WHERE EXISTS(...) gets semi-joins
●Inner-to-outer execution
●Trivially-correlated EXISTS get Materialization
● How to use
● set optimizer_switch='exists_to_in=on'
●Enjoy
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2825
New features in MariaDB 10.0 Optimizer
● Statistics
●Engine-independent statistics (Histograms)
● Algorithms
●Subquery optimizations: EXISTS-to-IN
● EXPLAIN improvements
●SHOW EXPLAIN
●EXPLAIN in the slow query log
●EXPLAIN for UPDATE/DELETE
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2826
SHOW EXPLAIN
● Shows EXPLAIN of a running query
client1> select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey ...
client2> show processlist;
+----+------+-----------+------+---------+------+--------------+--------------------------------------------------------
| Id | User | Host | db | Command | Time | State | Info
+----+------+-----------+------+---------+------+--------------+--------------------------------------------------------
| 2 | root | localhost | test | Query | 0 | init | show processlist
| 3 | root | localhost | db | Query | 4 | Sending data | select count(*) from customer, orders, nation where ...
+----+------+-----------+------+---------+------+--------------+--------------------------------------------------------
client2> show explain for 3;
+------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+-------------
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra
+------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+-------------
| 1 | SIMPLE | nation | ALL | PRIMARY | NULL | NULL | NULL | 25 | Using where
| 1 | SIMPLE | customer | ref | i_c_nationkey | i_c_nationkey | 5 | db.nation.n_nationkey | 83512 | Using index
| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 | db.customer.c_custkey | 8 | Using index
+------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+-------------
3 rows in set, 1 warning (0.00 sec)
client2> show warnings;
+-------+------+---------------------------------------------------------------------------------------------------------------
| Level | Code | Message
+-------+------+---------------------------------------------------------------------------------------------------------------
| Note | 1003 | select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name
+-------+------+---------------------------------------------------------------------------------------------------------------
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2827
SHOW EXPLAIN (2)
● SHOW EXPLAIN vs EXPLAIN $query_str
●Can see exactly what query plan is running
●EXPLAIN $query_str can be difficult
● @session_vars
● Per-connection settings (@@optimizer_switch?)
● temporary tables
● Uncommitted changes in a transaction
● Etc, etc
● MySQL 5.7: EXPLAIN FOR CONNECTION $id
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2828
EXPLAIN in the slow query log
● log_slow_verbosity=explain
# Time: 140402 6:55:35
# User@Host: root[root] @ localhost []
# Thread_id: 2 Schema: dbt3sf10 QC_hit: No
# Query_time: 15.532745 Lock_time: 0.378632 Rows_sent: 1 Rows_examined: 661743
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0
#
# explain: id select_type table type possible_keys key key_len ref rows Extra
# explain: 1 SIMPLE nation ALL PRIMARY NULL NULL NULL 25 Using where
# explain: 1 SIMPLE customer ref i_c_nationkey i_c_nationkey 5 db.nation.n_nationkey 82649 Us
# explain: 1 SIMPLE orders ref i_o_custkey i_o_custkey 5 db.customer.c_custkey 7 Using
#
use dbt3sf10;
SET timestamp=1396446935;
select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name='GERMAN
...
slow-query-log
long-query-time=1
log-slow-verbosity=query_plan,explain
my.cnf
$datadir/hostname-slow.log
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2829
EXPLAIN in the slow query log (2)
● Machine-parseable
● Lines start with “# explain: “
● Cells are tab-delimited
● Logs with explains are parsed by pt-query-digest
● Would like to make it report query plan stats
# Time: 140402 6:55:35
# User@Host: root[root] @ localhost []
# Thread_id: 2 Schema: dbt3sf10 QC_hit: No
# Query_time: 15.532745 Lock_time: 0.378632 Rows_sent: 1 Rows_examined: 661743
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0
#
# explain: id select_type table type possible_keys key key_len ref rows Extra
# explain: 1 SIMPLE nation ALL PRIMARY NULL NULL NULL 25 Using where
# explain: 1 SIMPLE customer ref i_c_nationkey i_c_nationkey 5 db.nation.n_nationkey 82649 Us
# explain: 1 SIMPLE orders ref i_o_custkey i_o_custkey 5 db.customer.c_custkey 7 Using
#
use dbt3sf10;
SET timestamp=1396446935;
select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name='GERMAN
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2830
Other EXPLAIN improvements
● EXPLAIN UPDATE/DELETE/INSERT
●MySQL 5.6 → MariaDB 10.0
● Not ported from MySQL 5.6 so far:
●EXPLAIN FORMAT=JSON
●Optimizer trace
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2831
MariaDB 10.0 summary
● Porting features from
MySQL 5.6
● Also adding our own
new features
● Actually leading the
development
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2832
Beyond MariaDB 10.0
● EXPLAIN FORMAT=JSON
● EXPLAIN ANALYZE [in the slow query log]
● More statistics
● More histogram types
● Observability
● Better use in the optimizer
● ORDER/GROUP BY … LIMIT: fix the mess
● Your input
● ...
Notice: MySQL is a registered trademark of Sun Microsystems, Inc.
17:41:2833
Thanks!
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

Optimizer features in recent releases of other databases
Optimizer features in recent releases of other databasesOptimizer features in recent releases of other databases
Optimizer features in recent releases of other databasesSergey Petrunya
 
Basic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsBasic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsSveta Smirnova
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Mysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperabilityMysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperabilitySergey Petrunya
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013Sergey Petrunya
 
Optimizer Trace Walkthrough
Optimizer Trace WalkthroughOptimizer Trace Walkthrough
Optimizer Trace WalkthroughSergey Petrunya
 
Using histograms to get better performance
Using histograms to get better performanceUsing histograms to get better performance
Using histograms to get better performanceSergey Petrunya
 
Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Sergey Petrunya
 
Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015mushupl
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexingFromDual GmbH
 
0888 learning-mysql
0888 learning-mysql0888 learning-mysql
0888 learning-mysqlsabir18
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionSveta Smirnova
 
Common Table Expressions in MariaDB 10.2
Common Table Expressions in MariaDB 10.2Common Table Expressions in MariaDB 10.2
Common Table Expressions in MariaDB 10.2Sergey Petrunya
 
MySQL Query tuning 101
MySQL Query tuning 101MySQL Query tuning 101
MySQL Query tuning 101Sveta Smirnova
 
Playing with the CONNECT storage engine
Playing with the CONNECT storage enginePlaying with the CONNECT storage engine
Playing with the CONNECT storage engineFederico Razzoli
 
Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Sveta Smirnova
 
ANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gemANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gemSergey Petrunya
 

Was ist angesagt? (20)

Optimizer features in recent releases of other databases
Optimizer features in recent releases of other databasesOptimizer features in recent releases of other databases
Optimizer features in recent releases of other databases
 
Basic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsBasic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database Administrators
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]s
 
Mysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperabilityMysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperability
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
 
Optimizer Trace Walkthrough
Optimizer Trace WalkthroughOptimizer Trace Walkthrough
Optimizer Trace Walkthrough
 
Using histograms to get better performance
Using histograms to get better performanceUsing histograms to get better performance
Using histograms to get better performance
 
Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Window functions in MariaDB 10.2
Window functions in MariaDB 10.2
 
Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015
 
MariaDB Temporal Tables
MariaDB Temporal TablesMariaDB Temporal Tables
MariaDB Temporal Tables
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexing
 
0888 learning-mysql
0888 learning-mysql0888 learning-mysql
0888 learning-mysql
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
Common Table Expressions in MariaDB 10.2
Common Table Expressions in MariaDB 10.2Common Table Expressions in MariaDB 10.2
Common Table Expressions in MariaDB 10.2
 
MySQL Query tuning 101
MySQL Query tuning 101MySQL Query tuning 101
MySQL Query tuning 101
 
Playing with the CONNECT storage engine
Playing with the CONNECT storage enginePlaying with the CONNECT storage engine
Playing with the CONNECT storage engine
 
Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...Introducing new SQL syntax and improving performance with preparse Query Rewr...
Introducing new SQL syntax and improving performance with preparse Query Rewr...
 
ANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gemANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gem
 

Ähnlich wie MariaDB 10.0 Query Optimizer

Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisMYXPLAIN
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)Valeriy Kravchuk
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL IndexingMYXPLAIN
 
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Nelson Calero
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015Dave Stokes
 
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015Dave Stokes
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 MinutesSveta Smirnova
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksMYXPLAIN
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightDataStax Academy
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2Morgan Tocker
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schemaMark Leith
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
sveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionsveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionDariia Seimova
 
Performance Schema in Action: demo
Performance Schema in Action: demoPerformance Schema in Action: demo
Performance Schema in Action: demoSveta Smirnova
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performanceGuy Harrison
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query OptimizationAnju Garg
 
How Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data ManagementHow Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data ManagementSingleStore
 

Ähnlich wie MariaDB 10.0 Query Optimizer (20)

Advanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and AnalysisAdvanced Query Optimizer Tuning and Analysis
Advanced Query Optimizer Tuning and Analysis
 
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
MariaDB 10.5 new features for troubleshooting (mariadb server fest 2020)
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL Indexing
 
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015
 
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New Tricks
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
sveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in actionsveta smirnova - my sql performance schema in action
sveta smirnova - my sql performance schema in action
 
Performance Schema in Action: demo
Performance Schema in Action: demoPerformance Schema in Action: demo
Performance Schema in Action: demo
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performance
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query Optimization
 
How Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data ManagementHow Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data Management
 

Mehr von Sergey Petrunya

New optimizer features in MariaDB releases before 10.12
New optimizer features in MariaDB releases before 10.12New optimizer features in MariaDB releases before 10.12
New optimizer features in MariaDB releases before 10.12Sergey Petrunya
 
MariaDB's join optimizer: how it works and current fixes
MariaDB's join optimizer: how it works and current fixesMariaDB's join optimizer: how it works and current fixes
MariaDB's join optimizer: how it works and current fixesSergey Petrunya
 
Improved histograms in MariaDB 10.8
Improved histograms in MariaDB 10.8Improved histograms in MariaDB 10.8
Improved histograms in MariaDB 10.8Sergey Petrunya
 
Improving MariaDB’s Query Optimizer with better selectivity estimates
Improving MariaDB’s Query Optimizer with better selectivity estimatesImproving MariaDB’s Query Optimizer with better selectivity estimates
Improving MariaDB’s Query Optimizer with better selectivity estimatesSergey Petrunya
 
JSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureJSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureSergey Petrunya
 
MariaDB 10.4 - что нового
MariaDB 10.4 - что новогоMariaDB 10.4 - что нового
MariaDB 10.4 - что новогоSergey Petrunya
 
MariaDB Optimizer - further down the rabbit hole
MariaDB Optimizer - further down the rabbit holeMariaDB Optimizer - further down the rabbit hole
MariaDB Optimizer - further down the rabbit holeSergey Petrunya
 
Lessons for the optimizer from running the TPC-DS benchmark
Lessons for the optimizer from running the TPC-DS benchmarkLessons for the optimizer from running the TPC-DS benchmark
Lessons for the optimizer from running the TPC-DS benchmarkSergey Petrunya
 
MariaDB 10.3 Optimizer - where does it stand
MariaDB 10.3 Optimizer - where does it standMariaDB 10.3 Optimizer - where does it stand
MariaDB 10.3 Optimizer - where does it standSergey Petrunya
 
MyRocks in MariaDB | M18
MyRocks in MariaDB | M18MyRocks in MariaDB | M18
MyRocks in MariaDB | M18Sergey Petrunya
 
New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3Sergey Petrunya
 
Histograms in MariaDB, MySQL and PostgreSQL
Histograms in MariaDB, MySQL and PostgreSQLHistograms in MariaDB, MySQL and PostgreSQL
Histograms in MariaDB, MySQL and PostgreSQLSergey Petrunya
 
MyRocks in MariaDB: why and how
MyRocks in MariaDB: why and howMyRocks in MariaDB: why and how
MyRocks in MariaDB: why and howSergey Petrunya
 
Эволюция репликации в MySQL и MariaDB
Эволюция репликации в MySQL и MariaDBЭволюция репликации в MySQL и MariaDB
Эволюция репликации в MySQL и MariaDBSergey Petrunya
 
MariaDB 10.1 - что нового.
MariaDB 10.1 - что нового.MariaDB 10.1 - что нового.
MariaDB 10.1 - что нового.Sergey Petrunya
 
MyRocks: табличный движок для MySQL на основе RocksDB
MyRocks: табличный движок для MySQL на основе RocksDBMyRocks: табличный движок для MySQL на основе RocksDB
MyRocks: табличный движок для MySQL на основе RocksDBSergey Petrunya
 
MariaDB: ANALYZE for statements (lightning talk)
MariaDB:  ANALYZE for statements (lightning talk)MariaDB:  ANALYZE for statements (lightning talk)
MariaDB: ANALYZE for statements (lightning talk)Sergey Petrunya
 
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
 

Mehr von Sergey Petrunya (20)

New optimizer features in MariaDB releases before 10.12
New optimizer features in MariaDB releases before 10.12New optimizer features in MariaDB releases before 10.12
New optimizer features in MariaDB releases before 10.12
 
MariaDB's join optimizer: how it works and current fixes
MariaDB's join optimizer: how it works and current fixesMariaDB's join optimizer: how it works and current fixes
MariaDB's join optimizer: how it works and current fixes
 
Improved histograms in MariaDB 10.8
Improved histograms in MariaDB 10.8Improved histograms in MariaDB 10.8
Improved histograms in MariaDB 10.8
 
Improving MariaDB’s Query Optimizer with better selectivity estimates
Improving MariaDB’s Query Optimizer with better selectivity estimatesImproving MariaDB’s Query Optimizer with better selectivity estimates
Improving MariaDB’s Query Optimizer with better selectivity estimates
 
JSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger pictureJSON Support in MariaDB: News, non-news and the bigger picture
JSON Support in MariaDB: News, non-news and the bigger picture
 
MariaDB 10.4 - что нового
MariaDB 10.4 - что новогоMariaDB 10.4 - что нового
MariaDB 10.4 - что нового
 
MariaDB Optimizer - further down the rabbit hole
MariaDB Optimizer - further down the rabbit holeMariaDB Optimizer - further down the rabbit hole
MariaDB Optimizer - further down the rabbit hole
 
Lessons for the optimizer from running the TPC-DS benchmark
Lessons for the optimizer from running the TPC-DS benchmarkLessons for the optimizer from running the TPC-DS benchmark
Lessons for the optimizer from running the TPC-DS benchmark
 
MariaDB 10.3 Optimizer - where does it stand
MariaDB 10.3 Optimizer - where does it standMariaDB 10.3 Optimizer - where does it stand
MariaDB 10.3 Optimizer - where does it stand
 
MyRocks in MariaDB | M18
MyRocks in MariaDB | M18MyRocks in MariaDB | M18
MyRocks in MariaDB | M18
 
New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3
 
MyRocks in MariaDB
MyRocks in MariaDBMyRocks in MariaDB
MyRocks in MariaDB
 
Histograms in MariaDB, MySQL and PostgreSQL
Histograms in MariaDB, MySQL and PostgreSQLHistograms in MariaDB, MySQL and PostgreSQL
Histograms in MariaDB, MySQL and PostgreSQL
 
Say Hello to MyRocks
Say Hello to MyRocksSay Hello to MyRocks
Say Hello to MyRocks
 
MyRocks in MariaDB: why and how
MyRocks in MariaDB: why and howMyRocks in MariaDB: why and how
MyRocks in MariaDB: why and how
 
Эволюция репликации в MySQL и MariaDB
Эволюция репликации в MySQL и MariaDBЭволюция репликации в MySQL и MariaDB
Эволюция репликации в MySQL и MariaDB
 
MariaDB 10.1 - что нового.
MariaDB 10.1 - что нового.MariaDB 10.1 - что нового.
MariaDB 10.1 - что нового.
 
MyRocks: табличный движок для MySQL на основе RocksDB
MyRocks: табличный движок для MySQL на основе RocksDBMyRocks: табличный движок для MySQL на основе RocksDB
MyRocks: табличный движок для MySQL на основе RocksDB
 
MariaDB: ANALYZE for statements (lightning talk)
MariaDB:  ANALYZE for statements (lightning talk)MariaDB:  ANALYZE for statements (lightning talk)
MariaDB: ANALYZE for statements (lightning talk)
 
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
 

Kürzlich hochgeladen

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Kürzlich hochgeladen (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

MariaDB 10.0 Query Optimizer

  • 1. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Sergei Petrunia Sergei Golubchik MariaDB & MySQL community event, Santa Clara, April 2014 MariaDB 10.0 Optimizer
  • 2. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:282 MySQL/MariaDB Optimizer history
  • 3. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:283 MariaDB 5.5
  • 4. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:284 MySQL 5.6
  • 5. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:285 MariaDB 10.0
  • 6. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:286 New features in MariaDB 10.0 Optimizer ● Statistics ●Engine-independent statistics (Histograms) ● Algorithms ●Subquery optimizations: EXISTS-to-IN ● EXPLAIN improvements ●SHOW EXPLAIN ●EXPLAIN in the slow query log ●EXPLAIN for UPDATE/DELETE
  • 7. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:287 New features in MariaDB 10.0 Optimizer ● Statistics ●Engine-independent statistics (Histograms) ● Algorithms ●Subquery optimizations: EXISTS-to-IN ● EXPLAIN improvements ●SHOW EXPLAIN ●EXPLAIN in the slow query log ●EXPLAIN for UPDATE/DELETE
  • 8. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:288 Query optimizer needs statistics select * from lineitem, orders where o_orderkey=l_orderkey and o_orderdate between '1990-01-01' and '1998-12-06' and l_extendedprice > 1000000
  • 9. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:289 Sources of statistics ● Total number of rows in table ● orders - … ● lineitem -... ● Number of rows that match parts of WHERE select * from lineitem, orders where o_orderkey=l_orderkey and o_orderdate between '1990-01-01' and '1998-12-06' and l_extendedprice > 1000000; ― “key CMP const” - range condition ―Precise estimates ―Requires an index ―B-Tree index dives ―Expensive to get.
  • 10. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2810 Sources of statistics (2) where o_orderkey=l_orderkey and o_orderdate between '1990-01-01' and '1998-12-06' and l_extendedprice > 1000000; ● orders.o_orderkey=... lineitem.l_orderkey=... ● “how many lineitem-s for some $orderkey”? ● Index statistics ● InnoDB ● Random sampling (innodb_stats_sample_pages) ● At “random” times ● MySQL 5.6: persistent statistics ● Still random sampling.
  • 11. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2811 Problems with statistics ● Index statistics: randomness ●Collected via sampling ●Different query plans ●Even for DBT-3 benchmark ●InnoDB Persistent Statistics is a partial solution ● Not index? no statistics ● not_indexed_column= 'foo' ● key_column2= 'bar'.
  • 12. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2812 MariaDB 10.0: Engine independent statistics ● No random sampling ●ANALYZE TABLE makes full table scan ● No auto-updates ●Statistics is deterministic ● More statistics data ●#rows in the table (same) ●Index statistics: cardinality (same) +Statistics on non-indexed columns +MIN/MAX values +Frequency +#NULL values +Histograms.
  • 13. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2813 New statistics test run select * from lineitem, orders where o_orderkey=l_orderkey and o_orderdate between '1990-01-01' and '1998-12-06' and l_extendedprice > 1000000 +--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+ |id|select_type|table |type|possible_keys|key |key_len|ref |rows |filtered|Extra | +--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+ |1 |SIMPLE |orders |ALL |PRIMARY |NULL |NULL |NULL |1494230| 100.00 |Using where| |1 |SIMPLE |lineitem|ref |PRIMARY,i_...|PRIMARY|4 |orders.o_orderkey|2 | 100.00 |Using where| +--+-----------+--------+----+-------------+-------+-------+-----------------+-------+--------+-----------+ ● 4.2 seconds ● filtered=100% ● Close to truth for o_orderdate between ... ● Far from truth for l_extendedprice > 1000000.
  • 14. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2814 New statistics test run (2) set histogram_size=200; set use_stat_tables='preferably' analyze table lineitem, orders; +------------------+---------+----------+-----------------------------------------+ | Table | Op | Msg_type | Msg_text | +------------------+---------+----------+-----------------------------------------+ | dbt3sf1.lineitem | analyze | status | Engine-independent statistics collected | | dbt3sf1.lineitem | analyze | status | OK | | dbt3sf1.orders | analyze | status | Engine-independent statistics collected | | dbt3sf1.orders | analyze | status | OK | +------------------+---------+----------+-----------------------------------------+ set optimizer_use_condition_selectivity=4; . ● Collect table statistics ● Make the optimizer use it
  • 15. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2815 New statistics test run (3) +--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+ |id|select_type|table |type |possible_keys|key |key_len|ref |rows |filtered|Extra | +--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+ |1 |SIMPLE |lineitem|ALL |PRIMARY,i_...|NULL |NULL |NULL |6001215| 0.50 |Using where| |1 |SIMPLE |orders |eq_ref|PRIMARY |PRIMARY|4 |lineitem.l_orderkey|1 | 99.50 |Using where| +--+-----------+--------+------+-------------+-------+-------+-------------------+-------+--------+-----------+ select * from lineitem, orders where o_orderkey=l_orderkey and o_orderdate between '1990-01-01' and '1998-12-06' and l_extendedprice > 1000000 ● Re-run the query ● lineitem.filtered=0.5% - ● 1.5 sec (from 4.2 sec) ● Can be more for many-table joins. l_extendedprice > 1000000
  • 16. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2816 New statistics summary ● Persistent, stable statistics ● Statistics for ● Indexes ● Columns (Histograms) ● Need to enable it and collect manually 1.Collect statistics 2.Make optimizer use it 3.Watch EXPLAIN EXTENDED, filtered%. set histogram_size=...; set use_stat_tables='preferably' -- 'complementary' analyze table tbl [persistent for columns (...) indexes (...)] set optimizer_use_condition_selectivity = 4;
  • 17. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2817 Further details ● Documentation update pending ●Will blog ● Percona Live talk today: ●MariaDB Optimizer: See? No indexes! ●4:30PM - 5:20PM @ Ballroom E.
  • 18. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2818 New features in MariaDB 10.0 Optimizer ● Statistics ●Engine-independent statistics (Histograms) ● Algorithms ●Subquery optimizations: EXISTS-to-IN ● EXPLAIN improvements ●SHOW EXPLAIN ●EXPLAIN in the slow query log ●EXPLAIN for UPDATE/DELETE
  • 19. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2819 Subquery optimizations background ● Traditional way: “straightforward” subquery execution select * from customer where customer.c_acctbal < 0 and exists (select 1 from orders where orders.o_custkey= customer.c_custkey AND orders.o_orderDATE between $DAY1 and $DAY2) +--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+ |id|select_type |table |type|possible_keys |key |key_len|ref |rows |Extra | +--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+ |1 |PRIMARY |customer|ALL |c_acctbal,i_c_acctbal_nationkey|NULL |NULL |NULL |150303|Using where| |2 |DEPENDENT SUBQUERY|orders |ref |i_o_orderdate,i_o_custkey |i_o_custkey|5 |customer.c_custkey|7 |Using where| +--+------------------+--------+----+-------------------------------+-----------+-------+------------------+------+-----------+
  • 20. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2820 Subquery optimizations background ● Traditional way: “straightforward” subquery execution select * from customer where customer.c_acctbal < 0 and exists (select 1 from orders where orders.o_custkey= customer.c_custkey AND orders.o_orderDATE between $DAY1 and $DAY2) ● Outer-to-inner execution ● Every subquery re-execution re-runs it from the start ● MariaDB 5.5 added subquery predicate cache.
  • 21. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2821 MariaDB 5.5, MySQL 5.6 Lots of optimizations for IN (SELECT ...) ● Materialization ● Subquery must be uncorrelated ● Semi-join optimizations ● Both inner-to-outer and outer-to-inner execution ● Materialization ● Join-like execution methods select * from customer where customer.c_acctbal < 0 and customer.c_custkey IN (select orders.o_custkey from orders where orders.o_orderDATE between ...)
  • 22. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2822 MariaDB 10.0 – EXISTS subqueries 1.Convert EXISTS into semi-join select * from customer where customer.c_acctbal < 0 and exists (select 1 from orders where orders.o_custkey= customer.c_custkey AND orders.o_orderDATE between $DAY1 and $DAY2) Semi-join optimizations ● Both inner-to-outer and outer-to-inner execution ● Join-like execution methods
  • 23. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2823 MariaDB 10.0 – EXISTS subqueries 2. Convert trivially-correlated EXISTS into IN EXISTS (select 1 from orders where orders.o_custkey=customer.c_custkey AND orders.o_orderDATE between $DAY1 and $DAY2) Uncorrelated subquery => can use Materialization orders.o_custkey IN (select customer.c_custkey from orders where orders.o_orderDATE between $DAY1 and $DAY2)
  • 24. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2824 EXISTS-to-IN summary ● Enables new subquery optimizations for EXISTS ●WHERE EXISTS(...) gets semi-joins ●Inner-to-outer execution ●Trivially-correlated EXISTS get Materialization ● How to use ● set optimizer_switch='exists_to_in=on' ●Enjoy
  • 25. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2825 New features in MariaDB 10.0 Optimizer ● Statistics ●Engine-independent statistics (Histograms) ● Algorithms ●Subquery optimizations: EXISTS-to-IN ● EXPLAIN improvements ●SHOW EXPLAIN ●EXPLAIN in the slow query log ●EXPLAIN for UPDATE/DELETE
  • 26. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2826 SHOW EXPLAIN ● Shows EXPLAIN of a running query client1> select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey ... client2> show processlist; +----+------+-----------+------+---------+------+--------------+-------------------------------------------------------- | Id | User | Host | db | Command | Time | State | Info +----+------+-----------+------+---------+------+--------------+-------------------------------------------------------- | 2 | root | localhost | test | Query | 0 | init | show processlist | 3 | root | localhost | db | Query | 4 | Sending data | select count(*) from customer, orders, nation where ... +----+------+-----------+------+---------+------+--------------+-------------------------------------------------------- client2> show explain for 3; +------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+------------- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra +------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+------------- | 1 | SIMPLE | nation | ALL | PRIMARY | NULL | NULL | NULL | 25 | Using where | 1 | SIMPLE | customer | ref | i_c_nationkey | i_c_nationkey | 5 | db.nation.n_nationkey | 83512 | Using index | 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 | db.customer.c_custkey | 8 | Using index +------+-------------+----------+------+---------------+---------------+---------+-----------------------+-------+------------- 3 rows in set, 1 warning (0.00 sec) client2> show warnings; +-------+------+--------------------------------------------------------------------------------------------------------------- | Level | Code | Message +-------+------+--------------------------------------------------------------------------------------------------------------- | Note | 1003 | select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name +-------+------+---------------------------------------------------------------------------------------------------------------
  • 27. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2827 SHOW EXPLAIN (2) ● SHOW EXPLAIN vs EXPLAIN $query_str ●Can see exactly what query plan is running ●EXPLAIN $query_str can be difficult ● @session_vars ● Per-connection settings (@@optimizer_switch?) ● temporary tables ● Uncommitted changes in a transaction ● Etc, etc ● MySQL 5.7: EXPLAIN FOR CONNECTION $id
  • 28. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2828 EXPLAIN in the slow query log ● log_slow_verbosity=explain # Time: 140402 6:55:35 # User@Host: root[root] @ localhost [] # Thread_id: 2 Schema: dbt3sf10 QC_hit: No # Query_time: 15.532745 Lock_time: 0.378632 Rows_sent: 1 Rows_examined: 661743 # Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # # explain: id select_type table type possible_keys key key_len ref rows Extra # explain: 1 SIMPLE nation ALL PRIMARY NULL NULL NULL 25 Using where # explain: 1 SIMPLE customer ref i_c_nationkey i_c_nationkey 5 db.nation.n_nationkey 82649 Us # explain: 1 SIMPLE orders ref i_o_custkey i_o_custkey 5 db.customer.c_custkey 7 Using # use dbt3sf10; SET timestamp=1396446935; select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name='GERMAN ... slow-query-log long-query-time=1 log-slow-verbosity=query_plan,explain my.cnf $datadir/hostname-slow.log
  • 29. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2829 EXPLAIN in the slow query log (2) ● Machine-parseable ● Lines start with “# explain: “ ● Cells are tab-delimited ● Logs with explains are parsed by pt-query-digest ● Would like to make it report query plan stats # Time: 140402 6:55:35 # User@Host: root[root] @ localhost [] # Thread_id: 2 Schema: dbt3sf10 QC_hit: No # Query_time: 15.532745 Lock_time: 0.378632 Rows_sent: 1 Rows_examined: 661743 # Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # # explain: id select_type table type possible_keys key key_len ref rows Extra # explain: 1 SIMPLE nation ALL PRIMARY NULL NULL NULL 25 Using where # explain: 1 SIMPLE customer ref i_c_nationkey i_c_nationkey 5 db.nation.n_nationkey 82649 Us # explain: 1 SIMPLE orders ref i_o_custkey i_o_custkey 5 db.customer.c_custkey 7 Using # use dbt3sf10; SET timestamp=1396446935; select count(*) from customer, orders, nation where c_custkey=o_custkey and c_nationkey=n_nationkey and n_name='GERMAN
  • 30. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2830 Other EXPLAIN improvements ● EXPLAIN UPDATE/DELETE/INSERT ●MySQL 5.6 → MariaDB 10.0 ● Not ported from MySQL 5.6 so far: ●EXPLAIN FORMAT=JSON ●Optimizer trace
  • 31. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2831 MariaDB 10.0 summary ● Porting features from MySQL 5.6 ● Also adding our own new features ● Actually leading the development
  • 32. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2832 Beyond MariaDB 10.0 ● EXPLAIN FORMAT=JSON ● EXPLAIN ANALYZE [in the slow query log] ● More statistics ● More histogram types ● Observability ● Better use in the optimizer ● ORDER/GROUP BY … LIMIT: fix the mess ● Your input ● ...
  • 33. Notice: MySQL is a registered trademark of Sun Microsystems, Inc. 17:41:2833 Thanks! Q&A