SlideShare a Scribd company logo
Optimizing your InnoDB buffer pool usage Steve Hardy
It decreases I/O load Why optimize buffer pool usage ?
It decreases I/O load
It decreases I/O load Why optimize buffer pool usage ?
More RAM
Page compression
Less (smaller) data
Rearrange data How ?
OVERSIMPLIFICATION WARNING Do not complain about inaccuracies, I’m just trying to make a general point
Let’s say our buffer pool is 20% of our total DB size
Let’s say accesses to cached pages take no time at all
Let’s say all data is equally accessed
Let’s look at the data access over a certain period of time, say 1hr Let’s take a look at why RAM cache works Total gain from cache: 20% of the accesses are cached, so we’re 20% faster than when he have no cache at all
Page accesses are more concentrated in some places than others
We want to cache the most-accessed places
Let’s say accesses follow a 1/x curve Fortunately, data access isn’t really like that Total gain from cache: 60% of accesses are in cached pages, 60% reduction in I/O, 2.5 times faster than without a cache.
The trick to optimizing your buffer pool usage is to make the histogram look more like a slope than a flat line So now what? A slope following 1/1 has an 20% increase with 20% cache size (1.2x faster) A slope following 1/x has an 60% increase with 20% cache size (2.5x faster) A slope following 1/x^2 has an 92% increase with 20% cache size (12.5x faster)
 
Get a hold of MariaDB or Percona Server (stock MySQL is uncapable for displaying these stats, maybe 5.6 ?)
See what pages you’re storing in the buffer pool: select * from information_schema.INNODB_BUFFER_POOL_PAGES_INDEX; +---------------------+----------+---------+--------+------------+--------+-------------+----------+-------+-----+--------------+-----------+------------+ | index_id  | space_id | page_no | n_recs | data_size  | hashed | access_time | modified | dirty | old | lru_position | fix_count | flush_type | +---------------------+----------+---------+--------+------------+--------+-------------+----------+-------+-----+--------------+-----------+------------+ |  945 |  0 |  115129 |  290 |  15080 |  0 |  1213040390 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  32820 |  549 |  15965 |  0 |  1213040370 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  112322 |  366 |  15006 |  0 |  1213040370 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  32831 |  506 |  15961 |  0 |  1213040349 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  111817 |  350 |  15050 |  0 |  1213040332 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  49176 |  535 |  15959 |  0 |  1213040307 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  113198 |  318 |  15030 |  0 |  1213040299 |  0 |  0 |  0 |  0 |  0 |  0 | |  945 |  0 |  32828 |  533 |  15966 |  0 |  1213040284 |  0 |  0 |  0 |  0 |  0 |  0 | Inspecting your buffer pool
index_id: reference to information_schema. INNODB_SYS_INDEXES
space_id: tablespace (ibdata file or file number in file_per_table)
Page_no: page number (unique)
N_recs: number of records on the page

More Related Content

What's hot (19)

Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at LocalyticsOptimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
MongoDB
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalability
jbellis
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
MongoDB
 
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
leifwalsh
 
Hadoop & Zing
Hadoop & ZingHadoop & Zing
Hadoop & Zing
Long Dao
 
MongoDB Aggregation Performance
MongoDB Aggregation PerformanceMongoDB Aggregation Performance
MongoDB Aggregation Performance
MongoDB
 
Migrating from MySQL to MongoDB
Migrating from MySQL to MongoDBMigrating from MySQL to MongoDB
Migrating from MySQL to MongoDB
James Carr
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
Mydbops
 
In-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common PatternsIn-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common Patterns
Srinath Perera
 
Redis database
Redis databaseRedis database
Redis database
Ñáwrás Ñzár
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
Rick Copeland
 
How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case
Kai Sasaki
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
MariaDB plc
 
MyRocks Deep Dive
MyRocks Deep DiveMyRocks Deep Dive
MyRocks Deep Dive
Yoshinori Matsunobu
 
Mongodb sharding
Mongodb shardingMongodb sharding
Mongodb sharding
xiangrong
 
hbaseconasia2017: HBase在Hulu的使用和实践
hbaseconasia2017: HBase在Hulu的使用和实践hbaseconasia2017: HBase在Hulu的使用和实践
hbaseconasia2017: HBase在Hulu的使用和实践
HBaseCon
 
Zing Database
Zing Database Zing Database
Zing Database
Long Dao
 
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
In-Memory Computing Summit
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at LocalyticsOptimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
MongoDB
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalability
jbellis
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
MongoDB
 
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
leifwalsh
 
Hadoop & Zing
Hadoop & ZingHadoop & Zing
Hadoop & Zing
Long Dao
 
MongoDB Aggregation Performance
MongoDB Aggregation PerformanceMongoDB Aggregation Performance
MongoDB Aggregation Performance
MongoDB
 
Migrating from MySQL to MongoDB
Migrating from MySQL to MongoDBMigrating from MySQL to MongoDB
Migrating from MySQL to MongoDB
James Carr
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
Mydbops
 
In-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common PatternsIn-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common Patterns
Srinath Perera
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
Rick Copeland
 
How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case
Kai Sasaki
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
MariaDB plc
 
Mongodb sharding
Mongodb shardingMongodb sharding
Mongodb sharding
xiangrong
 
hbaseconasia2017: HBase在Hulu的使用和实践
hbaseconasia2017: HBase在Hulu的使用和实践hbaseconasia2017: HBase在Hulu的使用和实践
hbaseconasia2017: HBase在Hulu的使用和实践
HBaseCon
 
Zing Database
Zing Database Zing Database
Zing Database
Long Dao
 
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
IMC Summit 2016 Innovation - Derek Nelson - PipelineDB: The Streaming-SQL Dat...
In-Memory Computing Summit
 

Similar to Optimizing InnoDB bufferpool usage (20)

SQLServer Database Structures
SQLServer Database Structures SQLServer Database Structures
SQLServer Database Structures
Antonios Chatzipavlis
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
Ligaya Turmelle
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
guest9912e5
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
Marco Tusa
 
Fudcon talk.ppt
Fudcon talk.pptFudcon talk.ppt
Fudcon talk.ppt
webhostingguy
 
OSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross LawleyOSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross Lawley
NETWAYS
 
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMRVancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Allice Shandler
 
What is MariaDB Server 10.3?
What is MariaDB Server 10.3?What is MariaDB Server 10.3?
What is MariaDB Server 10.3?
Colin Charles
 
The Heterogeneous Data lake
The Heterogeneous Data lakeThe Heterogeneous Data lake
The Heterogeneous Data lake
DataWorks Summit/Hadoop Summit
 
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibabahbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
Michael Stack
 
Exchange Server 2013 Database and Store Changes
Exchange Server 2013 Database and Store ChangesExchange Server 2013 Database and Store Changes
Exchange Server 2013 Database and Store Changes
Microsoft TechNet - Belgium and Luxembourg
 
DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2
Pranav Prakash
 
Hive Training -- Motivations and Real World Use Cases
Hive Training -- Motivations and Real World Use CasesHive Training -- Motivations and Real World Use Cases
Hive Training -- Motivations and Real World Use Cases
nzhang
 
Apache Hive, data segmentation and bucketing
Apache Hive, data segmentation and bucketingApache Hive, data segmentation and bucketing
Apache Hive, data segmentation and bucketing
earnwithme2522
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
Dave Stokes
 
VLDB Administration Strategies
VLDB Administration StrategiesVLDB Administration Strategies
VLDB Administration Strategies
Murilo Miranda
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
Nicolas Morales
 
[B14] A MySQL Replacement by Colin Charles
[B14] A MySQL Replacement by Colin Charles[B14] A MySQL Replacement by Colin Charles
[B14] A MySQL Replacement by Colin Charles
Insight Technology, Inc.
 
Nextag talk
Nextag talkNextag talk
Nextag talk
Joydeep Sen Sarma
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
Andrew Morgan
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
guest9912e5
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
Marco Tusa
 
OSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross LawleyOSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross Lawley
NETWAYS
 
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMRVancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Vancouver AWS Meetup Slides 11-20-2018 Apache Spark with Amazon EMR
Allice Shandler
 
What is MariaDB Server 10.3?
What is MariaDB Server 10.3?What is MariaDB Server 10.3?
What is MariaDB Server 10.3?
Colin Charles
 
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibabahbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
hbaseconasia2019 Phoenix Improvements and Practices on Cloud HBase at Alibaba
Michael Stack
 
DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day2
Pranav Prakash
 
Hive Training -- Motivations and Real World Use Cases
Hive Training -- Motivations and Real World Use CasesHive Training -- Motivations and Real World Use Cases
Hive Training -- Motivations and Real World Use Cases
nzhang
 
Apache Hive, data segmentation and bucketing
Apache Hive, data segmentation and bucketingApache Hive, data segmentation and bucketing
Apache Hive, data segmentation and bucketing
earnwithme2522
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
Dave Stokes
 
VLDB Administration Strategies
VLDB Administration StrategiesVLDB Administration Strategies
VLDB Administration Strategies
Murilo Miranda
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
Nicolas Morales
 
[B14] A MySQL Replacement by Colin Charles
[B14] A MySQL Replacement by Colin Charles[B14] A MySQL Replacement by Colin Charles
[B14] A MySQL Replacement by Colin Charles
Insight Technology, Inc.
 
Ad

More from Zarafa (20)

Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin developmentZarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa
 
Zarafa SummerCamp 2012 - Android Workshop
Zarafa SummerCamp 2012 - Android WorkshopZarafa SummerCamp 2012 - Android Workshop
Zarafa SummerCamp 2012 - Android Workshop
Zarafa
 
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday KeynoteZarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa
 
Zarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa SummerCamp 2012 - Project approach when migrating to ZarafaZarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa
 
Zarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa SummerCamp 2012 - Keynote Peter GantenZarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa
 
Zarafa SummerCamp 2012 - Yubikey integration
Zarafa SummerCamp 2012 - Yubikey integrationZarafa SummerCamp 2012 - Yubikey integration
Zarafa SummerCamp 2012 - Yubikey integration
Zarafa
 
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical informationZarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa
 
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdfZararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zarafa
 
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-pushZararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zarafa
 
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zarafa
 
Zararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zararfa SummerCamp 2012 - Community update and Zarafa Development ProcessZararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zarafa
 
Zararfa summer camp 2012 interesting tips & tricks when migrating to zarafa
Zararfa summer camp 2012   interesting tips & tricks when migrating to zarafaZararfa summer camp 2012   interesting tips & tricks when migrating to zarafa
Zararfa summer camp 2012 interesting tips & tricks when migrating to zarafa
Zarafa
 
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovationsZarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa
 
Zarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa SummerCamp 2012 - Deploying Zarafa ArchiverZarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa
 
Zarafa SummerCamp 2012 - Open Generation Gap
Zarafa SummerCamp 2012 - Open Generation GapZarafa SummerCamp 2012 - Open Generation Gap
Zarafa SummerCamp 2012 - Open Generation Gap
Zarafa
 
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxyZarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa
 
Zarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa SummerCamp 2012 - Zarafa 7.1 featuresZarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa
 
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administratorsZarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa
 
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zarafa
 
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa
 
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin developmentZarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Zarafa
 
Zarafa SummerCamp 2012 - Android Workshop
Zarafa SummerCamp 2012 - Android WorkshopZarafa SummerCamp 2012 - Android Workshop
Zarafa SummerCamp 2012 - Android Workshop
Zarafa
 
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday KeynoteZarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa
 
Zarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa SummerCamp 2012 - Project approach when migrating to ZarafaZarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa SummerCamp 2012 - Project approach when migrating to Zarafa
Zarafa
 
Zarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa SummerCamp 2012 - Keynote Peter GantenZarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa SummerCamp 2012 - Keynote Peter Ganten
Zarafa
 
Zarafa SummerCamp 2012 - Yubikey integration
Zarafa SummerCamp 2012 - Yubikey integrationZarafa SummerCamp 2012 - Yubikey integration
Zarafa SummerCamp 2012 - Yubikey integration
Zarafa
 
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical informationZarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa
 
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdfZararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zararfa SummerCamp 2012 - HA, multi-tenancy and SSO in Zentyal 2 and 3.pdf
Zarafa
 
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-pushZararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zararfa SummerCamp 2012 - Debian packaging Giraffe and D-push
Zarafa
 
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zararfa SummerCamp 2012 - Fedora update & PAM-MAPI Zarafa Ready certified com...
Zarafa
 
Zararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zararfa SummerCamp 2012 - Community update and Zarafa Development ProcessZararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zararfa SummerCamp 2012 - Community update and Zarafa Development Process
Zarafa
 
Zararfa summer camp 2012 interesting tips & tricks when migrating to zarafa
Zararfa summer camp 2012   interesting tips & tricks when migrating to zarafaZararfa summer camp 2012   interesting tips & tricks when migrating to zarafa
Zararfa summer camp 2012 interesting tips & tricks when migrating to zarafa
Zarafa
 
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovationsZarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa
 
Zarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa SummerCamp 2012 - Deploying Zarafa ArchiverZarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa SummerCamp 2012 - Deploying Zarafa Archiver
Zarafa
 
Zarafa SummerCamp 2012 - Open Generation Gap
Zarafa SummerCamp 2012 - Open Generation GapZarafa SummerCamp 2012 - Open Generation Gap
Zarafa SummerCamp 2012 - Open Generation Gap
Zarafa
 
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxyZarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa SummerCamp 2012 - Zarafa Cluster using a reverse proxy
Zarafa
 
Zarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa SummerCamp 2012 - Zarafa 7.1 featuresZarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa SummerCamp 2012 - Zarafa 7.1 features
Zarafa
 
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administratorsZarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa SummerCamp 2012 - Z-push 2.0 changes for administrators
Zarafa
 
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zararfa SummerCamp 2012 - Performing fast backups in large scale environments...
Zarafa
 
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa
 
Ad

Recently uploaded (20)

Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Palo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity FoundationPalo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity Foundation
VICTOR MAESTRE RAMIREZ
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Scott M. Graffius
 
Trends Report: Artificial Intelligence (AI)
Trends Report: Artificial Intelligence (AI)Trends Report: Artificial Intelligence (AI)
Trends Report: Artificial Intelligence (AI)
Brian Ahier
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
Extend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptxExtend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptx
hoang971
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Palo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity FoundationPalo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity Foundation
VICTOR MAESTRE RAMIREZ
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Scott M. Graffius
 
Trends Report: Artificial Intelligence (AI)
Trends Report: Artificial Intelligence (AI)Trends Report: Artificial Intelligence (AI)
Trends Report: Artificial Intelligence (AI)
Brian Ahier
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
Extend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptxExtend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptx
hoang971
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 

Optimizing InnoDB bufferpool usage

  • 1. Optimizing your InnoDB buffer pool usage Steve Hardy
  • 2. It decreases I/O load Why optimize buffer pool usage ?
  • 4. It decreases I/O load Why optimize buffer pool usage ?
  • 9. OVERSIMPLIFICATION WARNING Do not complain about inaccuracies, I’m just trying to make a general point
  • 10. Let’s say our buffer pool is 20% of our total DB size
  • 11. Let’s say accesses to cached pages take no time at all
  • 12. Let’s say all data is equally accessed
  • 13. Let’s look at the data access over a certain period of time, say 1hr Let’s take a look at why RAM cache works Total gain from cache: 20% of the accesses are cached, so we’re 20% faster than when he have no cache at all
  • 14. Page accesses are more concentrated in some places than others
  • 15. We want to cache the most-accessed places
  • 16. Let’s say accesses follow a 1/x curve Fortunately, data access isn’t really like that Total gain from cache: 60% of accesses are in cached pages, 60% reduction in I/O, 2.5 times faster than without a cache.
  • 17. The trick to optimizing your buffer pool usage is to make the histogram look more like a slope than a flat line So now what? A slope following 1/1 has an 20% increase with 20% cache size (1.2x faster) A slope following 1/x has an 60% increase with 20% cache size (2.5x faster) A slope following 1/x^2 has an 92% increase with 20% cache size (12.5x faster)
  • 18.  
  • 19. Get a hold of MariaDB or Percona Server (stock MySQL is uncapable for displaying these stats, maybe 5.6 ?)
  • 20. See what pages you’re storing in the buffer pool: select * from information_schema.INNODB_BUFFER_POOL_PAGES_INDEX; +---------------------+----------+---------+--------+------------+--------+-------------+----------+-------+-----+--------------+-----------+------------+ | index_id | space_id | page_no | n_recs | data_size | hashed | access_time | modified | dirty | old | lru_position | fix_count | flush_type | +---------------------+----------+---------+--------+------------+--------+-------------+----------+-------+-----+--------------+-----------+------------+ | 945 | 0 | 115129 | 290 | 15080 | 0 | 1213040390 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 32820 | 549 | 15965 | 0 | 1213040370 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 112322 | 366 | 15006 | 0 | 1213040370 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 32831 | 506 | 15961 | 0 | 1213040349 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 111817 | 350 | 15050 | 0 | 1213040332 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 49176 | 535 | 15959 | 0 | 1213040307 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 113198 | 318 | 15030 | 0 | 1213040299 | 0 | 0 | 0 | 0 | 0 | 0 | | 945 | 0 | 32828 | 533 | 15966 | 0 | 1213040284 | 0 | 0 | 0 | 0 | 0 | 0 | Inspecting your buffer pool
  • 21. index_id: reference to information_schema. INNODB_SYS_INDEXES
  • 22. space_id: tablespace (ibdata file or file number in file_per_table)
  • 24. N_recs: number of records on the page
  • 25. Data_size: size of data on the innodb page
  • 27. Modified (1/0): something was modified in the page since load
  • 28. Dirty (1/0): not flushed to disk yet Inspecting your buffer pool
  • 29. See what pages you’re storing in the buffer pool per table/index: select count(*) as pages, ta.SCHEMA as db, ta.NAME as tab, ind.NAME as ind FROM innodb_buffer_pool_pages_index AS bp JOIN innodb_sys_indexes AS ind ON bp.index_id=ind.id JOIN innodb_sys_tables AS ta ON ind.table_id = ta.id group by bp.index_id; Inspecting your buffer pool
  • 30. +-------+----------------+-------------+-----------+ | pages | db | tab | ind | +-------+----------------+-------------+-----------+ | 1 | | SYS_FOREIGN | FOR_IND | | 1 | | SYS_FOREIGN | REF_IND | | 1 | zarafa_db9 | tproperties | PRIMARY | | 1 | zarafa_db9 | tproperties | hi | | 4 | zarafa_db9 | properties | PRIMARY | | 1 | zarafa_db9 | syncs | sync_time | | 1 | zarafa_indexer | stores | PRIMARY | | 1 | zarafa_indexer | stores | id | | 14 | zarafa_indexer | docwords_2 | PRIMARY | | 17 | zarafa_indexer | docwords | PRIMARY | | 17 | zarafa_indexer | words | PRIMARY | | 1 | zarafa_indexer | updates | PRIMARY | | 1 | zarafa_indexer | updates | doc | | 1 | zarafa_indexer | sourcekeys | PRIMARY | +-------+----------------+-------------+-----------+
  • 31. More of an art than an exact science, here are some clues: 50% of your buffer pool is used by a table that contains 20% of your data
  • 32. 50% of your buffer pool is used by a table that you thought wouldn’t really impact performance How do I know something is ‘wrong’ ?
  • 33. Strategies: Increase record ‘density’: make your records smaller. This will give you more records per page, and therefore less pages for the same data
  • 34. Remove indexes if you can use others almost-as-efficiently
  • 35. Increase record ‘locality’: make sure that records that are accessed ‘around the same time’ have a higher chance of being on the same page Other, non-application strategies: Use page compression (may double or quadruple the number of pages you can hold in RAM) – but isn’t a sure-win since pages need to be decompressed in RAM as well.
  • 37. Try BKA (MariaDB 5.3) if you have this problem even within one query Okay, so how do I fix it ?
  • 38. If you’re reading a range in an index, locality is high by definition
  • 39. Things get less efficient when you join to some other table, each record will generate a single page read for the linked record
  • 40. There are some enemies: random ID’s (like GUIDs) and auto_increments that are accessed in some other order than the original insertion order Eg. table messages (id INTEGER auto_increment, userid INTEGER, data varchar(255), PRIMARY KEY (id)); This table is now read most optimally if you read them in the order they were received. In practice, this is really never needed (maybe during backup) Locality?
  • 41. Probably more interesting case, reading all the emails of a user: SELECT data FROM emails WHERE userid=10; The naïve approach would be to use an index: table messages (id INTEGER auto_increment, userid INTEGER, data varchar(255), PRIMARY KEY (id), KEY user (userid)); Increasing locality example index record Fast range read (1 page) Slow record lookup (eg 100 pages) 101 pages in the bufferpool
  • 42. Better idea is to have records that are accessed together, more closely packed, using InnoDB clustered index: table messages (id INTEGER auto_increment, userid INTEGER, data varchar(255), PRIMARY KEY (userid, id), UNIQUE KEY user (id)); Increasing locality example records Fast range read (~5 pages) 5 pages in the bufferpool
  • 43. In Zarafa, we have ‘summary’ information on emails (subject, from, to, x-mailer, etc)
  • 44. (we have databases up to 1 TB in a single table for 1000s of users) More locality: introducing redundant information Hierarchy (id, parentid) Properties (id, type, value) PRIMARY KEY(id,type) 4,1 5,1 6,1 7,1 4, ‘subject’, ‘hello’ 4, ‘from’, ‘[email protected]’ 4, ‘x-mailer’, ‘zarafa’ 5, ‘subject’, ‘hello again’ etc
  • 45. Eg: sort by subject (get all subjects of folder X): SELECT value FROM properties JOIN hierarchy ON properties.id = hierarchy.id WHERE hierarchy.parent=X and properties.type=Y; +----+-------------+------------+--------+----------------+---------+---------+------------------------+------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+--------+----------------+---------+---------+------------------------+------+-------+ | 1 | SIMPLE | hierarchy | ref | PRIMARY,parent | parent | 4 | const | 3 | | | 1 | SIMPLE | properties | eq_ref | PRIMARY | PRIMARY | 8 | bla.hierarchy.id,const | 1 | | +----+-------------+------------+--------+----------------+---------+---------+------------------------+------+-------+ Result: one random access per email, for 10000 emails, worst case 50 seconds Why this is slow
  • 46. Data is redundant, if you lost it, you could regenerate it
  • 47. Normally regarded as a bad idea
  • 49. Add ‘parentid’ into properties’ Introduce a little garbage for locality Hierarchy (id, parentid) Properties (id, garbage, type, value) PRIMARY KEY(id,garbage, type) 4,1 5,1 6,1 7,1 4, 1, ‘subject’, ‘hello’ 4, 1, ‘from’, ‘[email protected]’ 4, 1, ‘x-mailer’, ‘zarafa’ 5, 1, ‘subject’, ‘hello again’ etc
  • 51. If you are write-heavy, this will not work since increasing read-locality normally decreases write-locality What’s the catch? records Random writes cause Random reads into buffer pool
  • 52. You know, like {0999C37B-9F73-42bb-BA57-B88940FDD686}
  • 55. Each lookup or write will cause a single page to be loaded into the buffer pool for the sole purpose of reading or writing a single record
  • 56. Better idea: use fixed GUID + counter for example (at least inserts will go to the ‘same’ place) What’s wrong with GUIDs?