This document summarizes best practices for indexing in MySQL 5.6. It discusses the types of indexes, how indexes work, and how to optimize queries through proper index selection and design. Indexes can speed up queries by enabling fast data lookups, sorting, and avoiding full table scans. The document provides examples and guidelines for choosing effective primary keys, covering indexes, and multi-column indexes to maximize query performance.
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013Jaime Crespo
Tutorial delivered at Percona MySQL Conference Live London 2013.
It doesn't matter what new SSD technologies appear, or what are the latest breakthroughs in flushing algorithms: the number one cause for MySQL applications being slow is poor execution plan of SQL queries. While the latest GA version provided a huge amount of transparent optimizations -specially for JOINS and subqueries- it is still the developer's responsibility to take advantage of all new MySQL 5.6 features.
In this tutorial we will propose the attendants a sample PHP application with bad response time. Through practical examples, we will suggest step-by-step strategies to improve its performance, including:
* Checking MySQL & InnoDB configuration
* Internal (performance_schema) and external tools for profiling (pt-query-digest)
* New EXPLAIN tools
* Simple and multiple column indexing
* Covering index technique
* Index condition pushdown
* Batch key access
* Subquery optimization
How to analyze and tune sql queries for better performance percona15oysteing
The document discusses how to analyze and tune MySQL queries for better performance. It covers several key topics:
1) The MySQL optimizer selects the most efficient access method (e.g. table scan, index scan) based on a cost model that estimates I/O and CPU costs.
2) The join optimizer searches for the lowest-cost join order by evaluating partial plans in a depth-first manner and pruning less promising plans.
3) Tools like the performance schema provide query history and statistics to analyze queries and monitor performance bottlenecks like disk I/O.
4) Indexes, rewriting queries, and query hints can influence the optimizer to select a better execution plan.
The document discusses new improvements to the parser and optimizer in MySQL 5.7. Key points include:
1) The parser and optimizer were refactored for improved maintainability and stability. Parsing was separated from optimization and execution.
2) The cost model was improved with better record estimation for joins, configurable cost constants, and additional explain output.
3) A new query rewrite plugin allows rewriting queries without changing application code.
Multi faceted responsive search, autocomplete, feeds engine & logginglucenerevolution
Presented by Remi Mikalsen, Search Engineer, The Norwegian Centre for ICT in Education
Learn how utdanning.no leverages open source technologies to deliver a blazing fast multi-faceted responsive search experience and a flexible and efficient feeds engine on top of Solr 3.6. Among the key open source projects that will be covered are Solr, Ajax-Solr, SolrPHPClient, Bootstrap, jQuery and Drupal. Notable highlights are ajaxified pivot facets, multiple parents hierarchical facets, ajax autocomplete with edge-n-gram and grouping, integrating our search widgets on any external website, custom Solr logging and using Solr to deliver Atom feeds. utdanning.no is a governmental website that collects, normalizes and publishes study information for related to secondary school and higher education in Norway. With 1.2 million visitors each year and 12.000 indexed documents we focus on precise information and a high degree of usability for students, potential students and counselors.
The technology has almost written off MySQL as a database for new fancy NoSQL databases like MongoDB and Cassandra or even Hadoop for aggregation. But MySQL has a lot to offer in terms of 'ACID'ity, performance and simplicity. For many use-cases MySQL works well. In this week's ShareThis workshop we discuss different tips & techniques to improve performance and extend the lifetime of your MySQL deployment.
The document provides an overview of the MySQL query optimizer. It discusses how the optimizer performs logical transformations, cost-based optimizations, analyzes access methods, and optimizes join orders. The goal of the optimizer is to produce a query execution plan that uses the least resources. It considers factors like I/O and CPU costs to select optimal table access methods, join orders, and other optimizations to minimize the cost of executing the query.
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
The document discusses techniques for optimizing MySQL queries for better performance. It covers topics like cost-based query optimization in MySQL, selecting optimal data access methods like indexes, the join optimizer, subquery optimizations, and tools for monitoring and analyzing queries. The presentation agenda includes introductions to index selection, join optimization, subquery optimizations, ordering and aggregation, and influencing the optimizer. Examples are provided to illustrate index selection, ref access analysis, and the range optimizer.
Oracle tables can be organized as heap tables or index organized tables. Heap tables store rows together in blocks without any particular order, while index organized tables order rows based on primary key values. Tables can be partitioned to improve manageability and performance for large volumes of data. Table clusters group related tables together in blocks to reduce disk I/O and access time for joined queries on those tables.
This presentation focuses on optimization of queries in MySQL from developer’s perspective. Developers should care about the performance of the application, which includes optimizing SQL queries. It shows the execution plan in MySQL and explain its different formats - tabular, TREE and JSON/visual explain plans. Optimizer features like optimizer hints and histograms as well as newer features like HASH joins, TREE explain plan and EXPLAIN ANALYZE from latest releases are covered. Some real examples of slow queries are included and their optimization explained.
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
The document discusses how to analyze and tune queries for better performance in MySQL. It covers topics like cost-based query optimization in MySQL, tools for monitoring, analyzing and tuning queries, data access and index selection, the join optimizer, subqueries, sorting, and influencing the optimizer. The program agenda outlines these topics and their order.
With the introduction of SQL Server 2012 data developers have new ways to interact with their databases. This session will review the powerful new analytic windows functions, new ways to generate numeric sequences and new ways to page the results of our queries. Other features that will be discussed are improvements in error handling and new parsing and concatenating features.
Er is een stelling: 'If you can do it in SQL, use SQL.' Maar soms is zelfs de zeer krachtige Oracle versie van SQL niet genoeg en heb je behoefte aan méér, zoals loops, condities etc.
Oracle biedt sinds Oracle 9i de mogelijkheid om PL/SQL-code te bouwen en op te nemen in de FROM clause van je query. Hoe? Door de output van een PL/SQL functie zo te formatteren dat die op een tabel lijkt, dus met records van waarden (rijen met kolommen). Hiermee heb je alle kracht van PL/SQL én SQL tot je beschikking in je SQL-statement.
Deze aanpak biedt nóg een voordeel: de code in de PL/SQL-functie wordt slechts éénmaal uitgevoerd, en niet voor elke rij (functie in de WHERE-clause) of voor elke rij in het resultaat (functie in de SELECT).
If you can do it in SQL, use SQL
The document outlines an incremental indexing framework to index database tables using Apache Solr. It proposes using database views to collate relevant data from multiple tables and batch processing to periodically fetch updated records and convert them to XML documents to post to Solr. The key components are database views, a data fetcher, an XML converter, an indexer controller class, and a job scheduler that coordinates periodic indexing based on configured triggers.
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
The document discusses how to analyze and tune queries in MySQL for better performance. It covers topics like cost-based query optimization in MySQL, tools for monitoring, analyzing and tuning queries, data access and index selection, the join optimizer, subqueries, sorting, and influencing the optimizer. The program agenda outlines these topics with the goal of helping attendees understand and improve MySQL query performance.
This document discusses database indexing. It provides information on the benefits of indexes, how to create indexes, common misconceptions about indexing, and rules for determining when and how to create indexes. Key points include that indexes improve performance of queries by enabling faster data retrieval and synchronization; indexes should be created on columns frequently filtered in WHERE and JOIN clauses; and the order of columns in an index matters for its effectiveness.
Design and develop with performance in mind
Establish a tuning environment
Index wisely
Reduce parsing
Take advantage of Cost Based Optimizer
Avoid accidental table scans
Optimize necessary table scans
Optimize joins
Use array processing
Consider PL/SQL for “tricky” SQL
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...Ontico
Много лет назад у меня была задача разработать собственное хранилище для истории Instant Messenger'а. Начав с простого индексного дерева поверх mmap(2), я быстро понял, что mmap(2), madvise(2) и компания не подходят в качестве основы для движка СУБД. Я переключился на direct IO и начал разрабатывать свой собственный менеджер памяти, продвинутое вытеснение, планирование IO с адаптивным read ahead и, конечно, обработкой транзакций. Все эти вещи делают все разработчики СУБД десятилетиями.
Неудивительно, что современные операционные системы делают все те же самые вещи на свой лад, неподходящий разработчикам СУБД. Это и управление виртуальной памятью с вытеснением страниц, и планировщики ввода-вывода с read ahead. Файловые системы обрабатывают свои операции транзакционно, очень близко с базами данных. Но движки баз данных все равно должны реализовывать все эти механизмы самостоятельно.
В этой презентации мы посмотрим на Tempesta DB, часть проекта Tempesta FW (http://github.com/tempesta-tech/tempesta). Tempesta DB расширяет ядро Linux так, что она реализует управление памятью, вытеснение и ввод-вывод, пригодные для движков user-space баз данных. Она разработана для near real-time нагрузок и сейчас требует, чтобы все данные помещались в RAM.
Мы рассмотрим следующие вопросы:
- Управление памятью и IO в ОС и СУБД на примере Linux и InnoDB;
- Попытки сообщества разработчиков ядра Linux разработать необходимые интерфейсы ядра для СУБД;
- Расширения ядра Linux, вносимые Tempesta DB;
- Интерфейсы Tempesta DB для кастомных СУБД;
- Сценарии применения Tempesta DB для обработки Web контента и правил фильтрации в Tempesta FW.
Joined by Rick Nelson, Technical Solutions architect from NGINX Server Density take you though the do's and don'ts of monitoring NGINX. Critical and non critical metrics to monitor, important alerts to configure and the best monitoring tools available.
MySQL 5.7 - NoSQL - JSON, Protocol X, Document Store / Петр Зайцев (Percona)Ontico
В MySQL 5.7 появился целый ряд новых возможностей, позволяющих использовать MySQL в приложениях и как хранилище JSON-документов, и как реляционную базу данных.
В этом докладе мы расскажем о поддержке JSON в MySQL 5.7, а также поговорим о том, когда имеет смысл её использовать, и насколько хорошо она работает. Кроме т��го, мы остановимся на новом протоколе доступа к MySQL, поддерживающем SQL. Помимо этого, мы рассмотрим CRUD-операции и такие дополнительные функции, как асинхронная коммуникация и пайплайнинг (pipelining).
В заключительной части доклада мы расскажем о возможностях MySQL 5.7 в качестве хранилища документов.
MySQL® и MongoDB® - когда что лучше использовать? / Петр Зайцев (Percona)Ontico
Сегодня много дискуссий о том, что лучше - MySQL или PostgreSQL? Однако перед тем, как выбирать именно реляционную базу данных для своего проекта, стоит понять, является ли реляционная база данных наилучшим решением для него.
В рамках этого доклада мы сравним наиболее популярную реляционную базу данных с открытым кодом с наиболее популярным хранилищем документов с открытым кодом. Мы определим, в каких случаях эффективнее всего работает MySQL, а в каких - MongoDB. Мы также рассмотрим ситуации, в которых ни одна из этих баз данных не будет лучшим решением и в которых целесообразно остановить свой выбор на других технологиях.
MySQL Indexing - Best practices for MySQL 5.6MYXPLAIN
This document provides an overview of MySQL indexing best practices. It discusses the types of indexes in MySQL, how indexes work, and how to optimize queries through proper index selection and configuration. The presentation emphasizes understanding how MySQL utilizes indexes to speed up queries through techniques like lookups, sorting, avoiding full table scans, and join optimizations. It also covers new capabilities in MySQL 5.6 like index condition pushdown that provide more flexible index usage.
PostgreSQL and the future
Aaron Thul discusses PostgreSQL 9.0 which includes new features like streaming replication and improved error messages. He talks about the growing PostgreSQL community and major events. Potential threats to PostgreSQL include patent attacks and hiring away volunteer developers. The presentation encourages best practices like avoiding unnecessary data types and indexes to improve performance.
15 Ways to Kill Your Mysql Application Performanceguest9912e5
Jay is the North American Community Relations Manager at MySQL. Author of Pro MySQL, Jay has also written articles for Linux Magazine and regularly assists software developers in identifying how to make the most effective use of MySQL. He has given sessions on performance tuning at the MySQL Users Conference, RedHat Summit, NY PHP Conference, OSCON and Ohio LinuxFest, among others.In his abundant free time, when not being pestered by his two needy cats and two noisy dogs, he daydreams in PHP code and ponders the ramifications of __clone().
The document provides biographical information about Antonios Chatzipavlis, a SQL Server expert and evangelist. It then summarizes his presentation on statistics and index internals in SQL Server, which covers topics like cardinality estimation, inspecting and updating statistics, index structure and types, and identifying missing indexes. The presentation includes demonstrations of analyzing cardinality estimation and picking the right index key.
Jonathan is a MySQL consultant who specializes in SQL, indexing, and reporting for big data. This tutorial will cover strategies for resolving 80% of performance problems, including indexes, partitioning, intensive table optimization, and finding and addressing bottlenecks. The strategies discussed will be common, established approaches based on the presenter's experience working with MySQL since 2007.
The document discusses various techniques for performance tuning a database including indexing strategies, query optimization, and hardware upgrades. It provides details on different types of indexes like B-Trees, bitmap indexes, and hash indexes. The summary should recommend indexing on high-cardinality fields that are frequently queried, using the query optimizer to evaluate execution plans, and reviewing hardware needs.
This document provides an overview of a presentation on building better SQL Server databases. The presentation covers how SQL Server stores and retrieves data by looking under the hood at tables, data pages, and the process of requesting data. It then discusses best practices for database design such as using the right data types, avoiding page splits, and tips for writing efficient T-SQL code. The presentation aims to teach attendees how to design databases for optimal performance and scalability.
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
PostgreSQL provides several advantages for analytics projects:
1) It allows connecting to external data sources and performing analytics queries across different data stores using features like foreign data wrappers.
2) Features like materialized views, transactional DDLs, and rich SQL capabilities help build effective data warehouses and data marts for analytics.
3) Performance optimizations like table partitioning, BRIN indexes, and parallel queries enable PostgreSQL to handle large datasets and complex queries efficiently.
MYSQL Query Anti-Patterns That Can Be Moved to SphinxPythian
This document provides an overview and summary of MySQL and Sphinx search capabilities. It discusses some limitations of MySQL for certain queries and how Sphinx can help address those limitations by offloading search queries and enabling features like full-text search and geospatial search. The document also covers how to install, configure, and query Sphinx including indexing data from MySQL, running the Sphinx daemon, and connecting to it via SphinxQL or APIs.
Query Optimization with MySQL 5.6: Old and New TricksMYXPLAIN
The document discusses query optimization techniques for MySQL 5.6, including both established techniques and new features in 5.6. It provides an overview of tools for profiling queries such as EXPLAIN, the slow query log, and the performance schema. It also covers indexing strategies like compound indexes and index condition pushdown.
The document discusses various techniques for optimizing database performance in Oracle, including:
- Using the cost-based optimizer (CBO) to choose the most efficient execution plan based on statistics and hints.
- Creating appropriate indexes on columns used in predicates and queries to reduce I/O and sorting.
- Applying constraints and coding practices like limiting returned rows to improve query performance.
- Tuning SQL statements through techniques like predicate selectivity, removing unnecessary objects, and leveraging indexes.
Geek Sync I Consolidating Indexes in SQL ServerIDERA Software
You can watch the replay for this Geek Sync webcast in the IDERA Resource Center: http://ow.ly/OzvF50A5r07
Watch this Geek Sync with special guest Microsoft Certified Master Kendra Little to learn why duplicate indexes can be a big problem for your performance and maintenance. Kendra will show you three different index consolidation scenarios, and how you can measure the pros and cons of different consolidation options.
This document provides an overview of optimizing MySQL queries. It discusses optimization at the database and hardware levels, understanding query execution plans, using EXPLAIN to analyze queries, optimizing specific query types like counts and groups, indexing strategies like covering indexes, and partitioning tables for performance. The goal is to help readers write efficient queries and properly structure databases and indexes for high performance.
MySQL uses indexes to optimize queries and improve performance. Indexes are stored in b-trees to keep data sorted and allow fast searches, inserts and deletions. The selectivity of an index, or the ratio of unique values within a column, determines how effectively the index can reduce the result set size. Highly selective columns on frequently queried subsets of rows make the best candidates for indexes. MySQL can use indexes to optimize data lookups, sorting, avoiding full table scans, and certain aggregation functions.
Learn best practices for taking advantage of Amazon Redshift's columnar technology and parallel processing capabilities to improve your data warehouse performance.
This document provides guidance on optimizing database performance through techniques like indexing, query tuning, avoiding unnecessary operations, and following best practices for objects like stored procedures, triggers, views and transactions. It emphasizes strategies like indexing frequently accessed columns, avoiding correlated subqueries and unnecessary joins, tuning queries to select only required columns, and keeping transactions and locks as short as possible.
Introduction to MySQL Query Tuning for Dev[Op]sSveta Smirnova
To get data, we query the database. MySQL does its best to return requested bytes as fast as possible. However, it needs human help to identify what is important and should be accessed in the first place.
Queries, written smartly, can significantly outperform automatically generated ones. Indexes and Optimizer statistics, not limited to the Histograms only, help to increase the speed of the query a lot.
In this session, I will demonstrate by examples of how MySQL query performance can be improved. I will focus on techniques, accessible by Developers and DevOps rather on those which are usually used by Database Administrators. In the end, I will present troubleshooting tools which will help you to identify why your queries do not perform. Then you could use the knowledge from the beginning of the session to improve them.
MySQL: Know more about open Source DatabaseMahesh Salaria
- As a developer, it is important to understand MySQL's storage engines, data types, indexing, and normalization to build high-performing applications.
- MySQL has several storage engines that handle different table types differently in terms of transactions, locking, storage, and memory usage. Choosing the right engine depends on data usage.
- Properly normalizing data, using optimal data types, and adding indexes improves performance by reducing storage needs, memory usage, and speeding up queries.
Geek Sync | Why Did My Clever Index Change Backfire?IDERA Software
You can watch the replay for this Geek Sync webcast in the IDERA Resource Center: http://ow.ly/LBvZ50A5a8P
You've got a great indexing strategy to speed up your SQL Server! You deploy the change and then... it all goes wrong.
Join IDERA and Kendra Little as she explains why index changes may slow down queries, cause queries to fail, cause unexpected outages, or just not work like they did when you tested them. You’ll leave the session with a set of practical steps to ensure you sidestep common indexing blunders and have confidence that your clever index change will speed up your queries instead of slowing them down. This is a demo-packed session you will not want to miss.
About Kendra: Kendra Little teaches database administrators and developers how to consistently speed up their SQL Servers. She is a Microsoft Certified Master in SQL Server, a Microsoft MVP, and one of the few artists in the world to draw both dinosaurs and databases.
Similar to Работа с индексами - лучшие практики для MySQL 5.6, Петр Зайцев (Percona) (20)
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/2964.html
Одноклассники состоят из более чем восьми тысяч железных серверов, расположенных в нескольких дата-центрах. Каждая из этих машин была специализированной под конкретную задачу - как для обеспечения изоляции отказов, так и для обеспечения автоматизированного управления инфраструктурой.
...
Масштабируя DNS / Артем Гавриченков (Qrator Labs)Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/3032.html
Протокол DNS на семь лет старше, чем Всемирная паутина. Стандарты RFC 882 и 883, определяющие основную функциональность системы доменных имён, появились в конце 1983 года, а первая реализация последовала уже годом позже. Естественно, что у технологии столь старой и при этом по сей день активнейшим образом используемой просто не могли не накопиться особенности, неочевидные обыкновенным пользователям.
...
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/3010.html
В этом докладе я расскажу, как BigData-платформа помогает трансформировать Почту России, как мы управляем построением и развитием платформы. Расскажу про найденные удачные решения, например, как разбиение на продукты с понятными SLA и интерфейсами между ними помогло нам сохранять управляемость с ростом масштабов проекта.
...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 10:00
Тезисы:
http://www.highload.ru/2017/abstracts/2914.html
Казалось бы, что нужно для организации тестового окружения? Тестовая железка и копия боевого окружения - и тестовый сервер готов. Но как быть, когда проект сложный? А когда большой? А если нужно тестировать одновременно много версий? А если все это вместе?
Организация тестирования большого развивающегося проекта, где одновременно в разработке и тестировании около полусотни фич - достаточно непростая задача. Ситуация обычно осложняется тем, что иногда есть желание потрогать еще не полностью готовый функционал. В таких ситуациях часто возникает вопрос: "А куда это можно накатить и где покликать?"
...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2854.html
Из этого доклада вы узнаете о возможностях репликации и автофейловера PostgreSQL, в том числе о возможностях, ставших доступных в PostgreSQL 10.
Среди прочих, будет затронуты следующие темы:
* Виды репликации и решаемые с ее помощью проблемы.
* Настройка потоковой репликации.
* Настройка логической репликации.
* Настройка автофейловера / HA средствами Stolon и Consul.
После прослушивания доклада вы сможете самостоятельно настраивать репликацию и автофейловер PostgreSQL.
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 17:00
Тезисы:
http://www.highload.ru/2017/abstracts/3096.html
PostgreSQL is the world’s most advanced open source database. Indeed! With around 270 configuration parameters in postgresql.conf, plus all the knobs in pg_hba.conf, it is definitely ADVANCED!
How many parameters do you tune? 1? 8? 32? Anyone ever tuned more than 64?
No tuning means below par performance. But how to start? Which parameters to tune? What are the appropriate values? Is there a tool --not just an editor like vim or emacs-- to help users manage the 700-line postgresql.conf file?
Join this talk to understand the performance advantages of appropriately tuning your postgresql.conf file, showcase a new free tool to make PostgreSQL configuration possible for HUMANS, and learn the best practices for tuning several relevant postgresql.conf parameters.
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/3115.html
During this session we will cover the last development in ProxySQL to support regular expressions (RE2 and PCRE) and how we can use this strong technique in correlation with ProxySQL's query rules to anonymize live data quickly and transparently. We will explain the mechanism and how to generate these rules quickly. We show live demo with all challenges we got from the Community and we finish the session by an interactive brainstorm testing queries from the audience.
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/2957.html
Расскажем о нашем опыте разработки модуля межсетевого экрана для MySQL с использованием генератора парсеров ANTLR и языка Kotlin.
Подробно рассмотрим следующие вопросы:
— когда и почему целесообразно использовать ANTLR;
— особенности разработки ANTLR-грамматики для MySQL;
— сравнение производительности рантаймов для ANTLR в рамках задачи синтаксического анализа MySQL (C#, Java, Kotlin, Go, Python, PyPy, C++);
— вспомогательные DSL;
— микросервисная архитектура модуля экранирования SQL;
— полученные результаты.
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/3114.html
ProxySQL aims to be the most powerful proxy in the MySQL ecosystem. It is protocol-aware and able to provide high availability (HA) and high performance with no changes in the application, using several built-in features and integration with clustering software. During this session we will quickly introduce its main features, so to better understand how it works. We will then describe multiple use case scenarios in which ProxySQL empowers large MySQL installations to provide HA with zero downtime, read/write split, query rewrite, sharding, query caching, and multiplexing using SSL across data centers.
MySQL Replication — Advanced Features / Петр Зайцев (Percona)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/2954.html
MySQL Replication is powerful and has added a lot of advanced features through the years. In this presentation we will look into replication technology in MySQL 5.7 and variants focusing on advanced features, what do they mean, when to use them and when not, Including.
When should you use STATEMENT, ROW or MIXED binary log format?
What is GTID in MySQL and MariaDB and why do you want to use them?
What is semi-sync replication and how is it different from lossless semi-sync?
...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 12:00
Тезисы:
http://www.highload.ru/2017/abstracts/3120.html
Количество разработчиков мобильных приложений Сбербанк Онлайн с начала 2016 года выросло на порядок. Для того чтобы продолжать выпускать качественный продукт, мы кардинально перестраиваем процесс разработки.
Количество внутренних заказчиков тех или иных доработок в какой-то момент выросло настолько, что разработчики стали узким местом. Мы внедрили культуру разработки, которую можно условно назвать "внутренним open-source", сохранив за собой контроль над архитектурой и качеством проекта, но позволив разрабатывать новые фичи всем желающим.
...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2836.html
При использовании Eventually Consistent распределенных баз данных нет гарантий, что чтение возвращает результаты последних изменений данных, если чтение и запись производятся на разных узлах. Это ограничивает пропускную способность системы. Поддержка свойства Causal Consistency с��имает это ограничение, что позволяет улучшить масштабируемость, не требуя изменений в коде приложения.
...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/2858.html
Аудитория Одноклассников превышает 73 миллиона человек в России, СНГ и странах дальнего зарубежья. При этом ОК.ru - первая социальная сеть по просмотрам видео в рунете и крупнейшая сервисная платформа.
Качественный и количественный рост DDoS-атак за последние годы превращает их в одну из первоочередных проблем для крупнейших интернет-ресурсов. В зависимости от вектора атаки “узким” местом становится та или иная часть инфраструктуры. В частности, при SYN-flood первый удар приходится на систему балансировки трафика. От ее производительности зависит успех в противостоянии атаке.
...
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/3008.html
Никогда не было и вот снова случилось! Компания Google в результате перенаправления трафика сделала недостпуными в Японии несколько тысяч различных сервисов, большинство из которых никак не связано с самой компанией Google. Однако, подобные инциденты происходят с завидной регулярностью, вот только не всегда попадают в большие СМИ. У таких инцидентов могут быть разные причины, начиная от ошибок сетевых инженеров и заканчивая государственным регулированием.
...
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/2925.html
Облака и виртуализация – современные тренды развития IT-технологий. Операторы связи строят свои TelcoClouds на стандартах NFV (Network Functions Virtualization) и SDN (Software-Defined Networking). В докладе начнем с основ виртуализации, далее разберемся, для чего используются NFV и SDN, потом полетим к облакам и вернемся на землю для решения практических задач!
...
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 10:00
Тезисы:
http://www.highload.ru/2017/abstracts/3045.html
Как мы заставили Druid работать в Одноклассниках.
«Druid is a high-performance, column-oriented, distributed data store» http://druid.io.
Мы расскажем о том, как, внедрив Druid, мы справились с ситуацией, когда MSSQL-based система статистики на 50 терабайт стала:
- медленной: средняя скорость ответа была в разы меньше требуемой (и увеличилась в 20 раз);
- нестабильной: в час пик статистика отставала до получаса (теперь ничего не отстает);
- дорогой: изменилась политика лицензирования Microsoft, расходы на лицензии могли составить миллионы долларов.
...
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2905.html
Прошло более года с того момента, как Microsoft выпустила первую версию своего нового фреймворка для разработки web-приложений ASP.NET Core, и с каждым днем он находит все больше поклонников. ASP.NET Core базируется на платформе .NET Core, кроссплатформенной версии платформы .NET c открытым исходным кодом. Теперь у С#-разработчиков появилась возможность использовать Mac в качестве среды разработки, и запускать приложения на Linux или внутри Docker-контейнеров.
...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/2913.html
Изначально будут раскрыты базовые причины, которые заставили появиться такой части механизма СУБД, как кэш результатов, и почему в ряде СУБД он есть или отсутствует.
Будут рассмотрены различные варианты кэширования результатов как sql-запросов, так и результатов хранимой в БД бизнес-логики. Произведено сравнение способов кэширования (программируемые вручную кэши, стандартный функционал) и даны рекомендации, когда и в каких случаях данные способы оптимальны, а порой опасны.
...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/2947.html
Apache Ignite — Open Source платформа для высокопроизводительной распределенной работы с большими данными с применением SQL или Java/.NET/C++ API. Ignite используют в самых разных отраслях. Сбербанк, ING, RingCentral, Microsoft, e-Therapeutics — все эти компании применяют решения на основе Ignite. Размеры кластеров разнятся от всего одного узла до нескольких сотен, узлы могут быть расположены в одном ЦОД-е или в нескольких геораспределенных.
...
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 12:00
Тезисы:
http://www.highload.ru/2017/abstracts/3005.html
Когда мы говорим о нагруженных системах и базах данных с большим числом параллельных коннектов, особый интерес представляет практика эксплуатации и сопровождения таких проектов. В том числе инструменты и механизмы СУБД, которые могут быть использованы DBA и DevOps-инженерами для решения задач мониторинга жизнедеятельности базы данных и ранней диагностики возможных проблем.
...
The Money Wave 2024 Review: Is It the Key to Financial Success?nirahealhty
What is The Money Wave?
The Money Wave is a wealth manifestation software designed to help individuals attract financial abundance through audio tracks. Created by James Rivers, this program uses scientifically-backed methods to improve cognitive functions and reduce stress, thereby enhancing one's ability to manifest wealth.
How Does The Money Wave Audio Program Work?
The Cash Wave program works by utilizing the force of sound frequencies to overhaul your cerebrum. These audio tracks are designed to promote deep relaxation and improve cognitive functions. The underlying science suggests that specific sound waves can influence brain activity, leading to enhanced problem-solving abilities and reduced stress levels.
How to Use The Money Wave Program?
Using The Money Wave program is straightforward:
Download the Audio Tracks: Once purchased, you can download the audio files from the official website.
Listen Daily: For best results, listen to the tracks daily. Consistency is key.
Relax and Visualize: Find a quiet place, relax, and visualize your financial goals as you listen.
Follow the Guide: The program includes a detailed guide to help you maximize the benefits.
In today's digital world, digital marketers are indispensable. They play a crucial role in helping businesses connect with their audiences effectively through various online channels. Whether you're considering a career change or aiming to advance in the field, here’s a detailed guide to thriving as a digital marketer in 2024.
Why Choose Digital Marketing?
Digital marketing encompasses a wide array of strategies aimed at engaging and converting online audiences. From optimizing websites for search engines to crafting compelling social media campaigns and leveraging data analytics, digital marketers drive business growth and enhance brand visibility in the digital sphere.
Essential Skills for Success
To excel in digital marketing, mastering a diverse skill set is essential:
1. SEO (Search Engine Optimization)
Understanding Search Engine Optimization principles is vital for enhancing a website's visibility in search engine results. This includes keyword research, on-page optimization techniques, and building authoritative backlinks to boost organic traffic.
2. PPC (Pay-Per-Click) Advertising
PPC advertising involves placing targeted ads on search engines and social media platforms, paying only when users click. Proficiency in platforms like Google Ads and Facebook Ads, along with strategic bidding and ad copywriting skills, is crucial for maximizing campaign ROI.
3. Social Media Marketing
Social media platforms serve as powerful tools for engaging with audiences and building brand loyalty. Effective social media marketers understand platform nuances, create engaging content, and utilize analytics to refine strategies and drive meaningful engagement.
4. Content Marketing
Content marketing revolves around creating valuable, relevant content that attracts and retains target audiences. This includes blog posts, videos, infographics, and eBooks tailored to resonate with audience interests and needs.
5. Email Marketing
Email marketing remains an effective channel for nurturing leads and maintaining customer relationships. Skills in crafting personalized campaigns, segmenting audiences, and analyzing email performance metrics are essential for optimizing campaign effectiveness.
6. Analytics and Data Interpretation
Data-driven decision-making is pivotal in digital marketing success. Proficiency in tools like Google Analytics enables marketers to track website traffic, user behavior, and campaign performance, providing actionable insights to drive continuous improvement.
Choosing the right web hosting provider can be a daunting task, especially with the plethora of options available. To help you make an informed decision, we’ve compiled comprehensive reviews of some of the top web hosting providers for 2024, with a special focus on Hosting Mastery Hub. This guide will cover the features, pros, cons, and unique offerings of each provider. By the end, you’ll have a clearer understanding of which hosting service best suits your needs.
The Money Wave 2024 Review_ Is It the Key to Financial Success.pdfnirahealhty
What is The Money Wave?
The Money Wave is a comprehensive financial program designed to equip individuals with the knowledge and tools necessary for achieving financial independence. It encompasses a range of resources, including educational materials, webinars, and community support, all aimed at helping users understand and leverage various financial opportunities.
➡️ Click here to get The Money Wave from the official website.
Key Features of The Money Wave
Educational Resources: The Money Wave offers a wealth of educational materials that cover essential financial topics, including budgeting, investing, and wealth-building strategies. These resources are designed to empower users with the knowledge needed to make informed financial decisions.
Expert Guidance: Users gain access to insights from financial experts who share their experiences and strategies for success. This guidance can be invaluable for individuals looking to navigate the complexities of personal finance.
Community Support: The program fosters a supportive community where users can connect with like-minded individuals. This network provides encouragement, accountability, and shared experiences that can enhance the learning process.
Actionable Strategies: The Money Wave emphasizes practical, actionable strategies that users can implement immediately. This focus on real-world application sets it apart from other financial programs that may be more theoretical in nature.
Flexible Learning: The program is designed to accommodate various learning styles and schedules. Users can access materials at their convenience, making it easier to integrate financial education into their daily lives.
Benefits of The Money Wave
Increased Financial Literacy: One of the primary benefits of The Money Wave is the enhancement of financial literacy. Users learn essential concepts that enable them to make better financial decisions, ultimately leading to improved financial health.
Empowerment: By providing users with the tools and knowledge needed to take control of their finances, The Money Wave empowers individuals to take proactive steps toward achieving their financial goals.
Networking Opportunities: The community aspect of The Money Wave allows users to connect with others who share similar financial aspirations. This network can lead to valuable partnerships, collaborations, and support systems.
Long-Term Success: The strategies taught in The Money Wave are designed for long-term success. Users are encouraged to adopt a mindset of continuous learning and growth for sustained financial well-being.
Accessibility: With its online format, The Money Wave is accessible to anyone with an internet connection. This inclusivity allows individuals from various backgrounds to benefit from the program.
Java Training in Chandigarh.Mastering Java: From Fundamentals to Advanced App...aryan4bhardwaj37
Excel in Java Programming with Excellence Academy‘s top-notch Best Java training & Certification in Chandigarh. Immerse yourself in 100% practical training on live projects from global clients in the USA, UK, France, and Germany. Our comprehensive program covers the development of dynamic web applications, emphasizing Java, Servlets, JSP, Spring, and more. Whether pursuing a full-time one-year diploma or a short-term course, Excellence Academy offers a 2-year validity for your Java programming journey. Our Java training is the gateway to mastering programming languages and building robust, scalable applications. So enroll now the Java Complete Course For Beginners.
How Can Microsoft Office 365 Improve Your Productivity?Digital Host
Microsoft Office 365 is a cloud-based subscription service offering essential productivity tools. It includes Word for documents, Excel for data analysis, PowerPoint for presentations, Outlook for email, OneDrive for cloud storage, and Teams for collaboration. Key benefits are accessibility from any device, advanced security, and regular updates. Office 365 enhances collaboration with real-time co-authoring and Teams, streamlines communication with Outlook and Teams Chat, and improves data management with OneDrive and SharePoint. For reliable office 365 hosting, Digital Host offers various subscription plans, setup support, and training resources. Visit https://www.digitalhost.com/email-office/office-365/
Do it again anti Republican shirt Do it again anti Republican shirtexgf28
Do it again anti Republican shirt
https://www.pinterest.com/youngtshirt/do-it-again-anti-republican-shirt/
Do it again anti Republican shirt,Do it again anti Republican t shirts,Do it again anti Republican sweatshirts Grabs yours today. tag and share who loves it.
Do it again anti Republican shirt Do it again anti Republican shirt
Работа с индексами - лучшие практики для MySQL 5.6, Петр Зайцев (Percona)
1. MySQL Indexing
Best Practices for MySQL 5.6
Peter Zaitsev
CEO, Percona
Highload++ 2014, Moscow, Russia
Nov 1, 2014
2. www.percona.com
About Percona
Open Source
Software for MySQL
Ecosystem
• Percona Server
• Percona XtraDB
Cluster (PXC)
• Percona Xtrabackup
• Percona Toolkit
Solutions to succeed
with MySQL
• Consulting
• Support
• Managed Services
2
3. www.percona.com
You’ve Made a Great Choice !
Understanding indexing is crucial both for
Developers and DBAs
Poor index choices are responsible for large
portion of production problems
Indexing is not a rocket science
4. www.percona.com
MySQL Indexing: Agenda
Understanding Indexing
Setting up best indexes for your
applications
Working around common MySQL
limitations
5. www.percona.com
Indexing in the Nutshell
• Speed up access in the database
• Help to enforce constraints
(UNIQUE, FOREIGN KEY)
• Queries can be ran without any
indexes
• But it can take a really long time
What
are
indexes
for ?
6. Types of Indexes you might heard about
• Majority of indexes you deal in MySQL is
this type BTREE Indexes
www.percona.com
RTREE Indexes • MyISAM only, for GIS
HASH Indexes • MEMORY, NDB
FULLTEXT Indexes • MyISAM, Innodb starting 5.6
7. www.percona.com
Family of BTREE like Indexes
• Share same properties in what operations
they can speed up
• Memory vs Disk is life changer
A lot of different
implementations
• Data stored in leaf nodes
B+ Trees are
typically used for
Disk storage
• But physically a lot different
TokuDB Fractal
Trees are logically
similar
9. www.percona.com
Indexes in MyISAM vs Innodb
In MyISAM data pointers
point to physical offset in
the data file
• All indexes are
essentially equivalent
In Innodb
• PRIMARY KEY (Explicit
or Implicit) - stores data
in the leaf pages of the
index, not pointer
• Secondary Indexes –
store primary key as
data pointer
10. What Operations can BTREE Index do ?
Find all rows with KEY=5 (point lookup)
www.percona.com
Find all rows with KEY>5 (open range)
Find all rows with 5<KEY<10 (closed range)
NOT find all rows with last digit of the KEY is Zero
• This can’t be defined as a “range” operation
11. www.percona.com
String Indexes
• Sort order is defined for strings
(collation)
• “AAAA” < “AAAB”
There is no
difference…
really
• LIKE “ABC%” means
• “ABC[LOWEST]”<KEY<“ABC[HIGHEST]”
• LIKE “%ABC” can’t be optimized by use
of the index
Prefix LIKE is
a special type
of Range
12. www.percona.com
Multiple Column Indexes
•KEY(col1,col2,col3)
•(1,2,3) < (1,3,1)
Sort Order is
defined,
comparing leading
column, then
second etc
•not a separate BTREE
index for each level
It is still one BTREE
Index
13. www.percona.com
Overhead of The Indexing
Indexes are costly; Do not add more than you
need
• In most cases extending index is better than adding new one
Writes - Updating indexes is often major cost of
database writes
Reads - Wasted space on disk and in memory;
additional overhead during query optimization
14. www.percona.com
Indexing Innodb Tables
• Pick PRIMARY KEY what suites you best
• For comments – (POST_ID,COMMENT_ID) can be
good PRIMARY KEY storing all comments for
single post close together
• Alternatively “pack” to single BIGINT
Data is
clustered by
Primary Key
• KEY (A) is really KEY (A,ID) internally
• Useful for sorting, Covering Index.
PRIMARY KEY
is implicitly
appended to
all indexes
15. www.percona.com
How MySQL Uses Indexes
Data Lookups
Sorting
Avoiding reading “data”
Special Optimizations
16. www.percona.com
Using Indexes for Data Lookups
• The classical use of index on
(LAST_NAME)
SELECT * FROM
EMPLOYEES WHERE
LAST_NAME=“Smith”
• SELECT * FROM EMPLOYEES WHERE
LAST_NAME=“Smith” AND
DEPT=“Accounting”
• Will use index on (DEPT,LAST_NAME)
Can use Multiple
column indexes
17. www.percona.com
It Gets Tricky With Multiple Columns
Index (A,B,C) •- order of columns matters
•A>5
•A=5 AND B>6
•A=5 AND B=6 AND C=7
•A=5 AND B IN (2,3) AND C>5
Will use Index for lookup
(all listed keyparts)
•B>5 – Leading column is not referenced
•B=6 AND C=7 - Leading column is not referenced Will NOT use Index
•A>5 AND B=2 - range on first column; only use this key part
•A=5 AND B>6 AND C=2 - range on second column, use 2 parts Will use Part of the index
18. www.percona.com
The First Rule of MySQL Optimizer
MySQL will stop using key parts in
multi part index as soon as it met
the real range (<,>, BETWEEN), it
however is able to continue using
key parts further to the right if
IN(…) range is used
19. www.percona.com
Using Index for Sorting
• Will use index on SCORE column
• Without index MySQL will do “filesort”
(external sort) which is very expensive
SELECT * FROM
PLAYERS ORDER
BY SCORE DESC
LIMIT 10
• SELECT * FROM PLAYERS WHERE
COUNTRY=“US” ORDER BY SCORE DESC LIMIT
10
• Best served by Index on (COUNTRY,SCORE)
Often
Combined with
using Index for
lookup
20. Multi Column indexes for efficient sorting
www.percona.com
• It becomes even more restricted!
• KEY(A,B)
• Will use Index for Sorting
– ORDER BY A - sorting by leading column
– A=5 ORDER BY B - EQ filtering by 1st and sorting by 2nd
– ORDER BY A DESC, B DESC - Sorting by 2 columns in same order
– A>5 ORDER BY A - Range on the column, sorting on the same
• Will NOT use Index for Sorting
– ORDER BY B - Sorting by second column in the index
– A>5 ORDER BY B – Range on first column, sorting by second
– A IN(1,2) ORDER BY B - In-Range on first column
– ORDER BY A ASC, B DESC - Sorting in the different order
21. www.percona.com
MySQL Using Index for Sorting Rules
You can’t sort in different order by 2 columns
You can only have Equality comparison (=)
for columns which are not part of ORDER BY
• Not even IN() works in this case
22. www.percona.com
Avoiding Reading The data
• Applies to index use for specific query,
not type of index.
“Covering Index”
• Index is typically smaller than data Reading Index ONLY and
not accessing the “data”
• KEY(CUSTOMER_ID,STATUS)
SELECT STATUS FROM
ORDERS WHERE
CUSTOMER_ID=123
• Access through data pointers is often
quite “random”
Access is a lot more
sequential
23. www.percona.com
Min/Max Optimizations
• Index help MIN()/MAX() aggregate functions
– But only these
• SELECT MAX(ID) FROM TBL;
• SELECT MAX(SALARY) FROM EMPLOYEE
GROUP BY DEPT_ID
– Will benefit from (DEPT_ID,SALARY) index
– “Using index for group-by”
24. www.percona.com
Indexes and Joins
• SELECT * FROM POSTS,COMMENTS WHERE AUTHOR=“Peter” AND
COMMENTS.POST_ID=POSTS.ID
• Scan table POSTS finding all posts which have Peter as an Author
• For every such post go to COMMENTS table to fetch all comments
MySQL Performs
Joins as “Nested
Loops”
• The index on POSTS.ID is not needed for this query performance
Index is only needed
on table which is
being looked up
• Re-Design JOIN queries which can’t be well indexed
Very important to
have all JOINs
Indexed
25. www.percona.com
Using Multiple Indexes for the table
• “Index Merge”
MySQL Can use
More than one
index
• Can often use Indexes on (A) and (B)
separately
• Index on (A,B) is much better
SELECT * FROM
TBL WHERE A=5
AND B=6
• 2 separate indexes is as good as it gets
• Index (A,B) can’t be used for this query
SELECT * FROM
TBL WHERE A=5
OR B=6
26. www.percona.com
Prefix Indexes
• ALTER TABLE TITLE ADD
KEY(TITLE(20));
• Needed to index BLOB/TEXT
columns
• Can be significantly smaller
• Can’t be used as covering index
• Choosing prefix length becomes the
question
You can
build Index
on the
leftmost
prefix of
the column
27. www.percona.com
Choosing Prefix Length
• Prefix should be “Selective enough”
– Check number of distinct prefixes vs number of
total distinct values
mysql> select count(distinct(title)) total,
count(distinct(left(title,10))) p10,
count(distinct(left(title,20))) p20 from title;
+--------+--------+--------+
| total | p10 | p20 |
+--------+--------+--------+
| 998335 | 624949 | 960894 |
+--------+--------+--------+
1 row in set (44.19 sec)
28. Most common Titles Most Common Title Prefixes
www.percona.com
Choosing Prefix Length
• Check for Outliers
– Ensure there are not too many rows sharing the
same prefix
mysql> select count(*) cnt, title tl
from title group by tl order by cnt desc
limit 3;
+-----+-----------------+
| cnt | tl |
+-----+-----------------+
| 136 | The Wedding |
| 129 | Lost and Found |
| 112 | Horror Marathon |
+-----+-----------------+
3 rows in set (27.49 sec)
mysql> select count(*) cnt, left(title,20) tl
from title group by tl order by cnt desc
limit 3;
+-----+----------------------+
| cnt | tl |
+-----+----------------------+
| 184 | Wetten, dass..? aus |
| 136 | The Wedding |
| 129 | Lost and Found |
+-----+----------------------+
3 rows in set (33.23 sec)
29. www.percona.com
What is new with MySQL 5.6 ?
• Most of them will make your queries better
automatically
• join_buffer_size variable has whole new meaning
• Values if 32MB+ can make sense
Many Optimizer
improvements
• Most important one: ICP (Index Condition
Pushdown)
Focus on Index
Design Practices
for this
presentation
30. www.percona.com
Understanding ICP
• Think NAME LIKE “%ill%” (will not
convert to range)
Push where clause
“Conditions” for
Storage engine to filter
• Plus filtering done on the engine level
– efficient
“Much more flexible
covering Index”
• All or none. All is resolved through the
index or “row” is read if within range
Before MySQL 5.5
31. www.percona.com
ICP Examples
• SELECT A … WHERE B=2 AND C LIKE “%ill%’
– MySQL 5.5 and below
• KEY (B) – Traditional. Using index for range only
• KEY (B,C,A) - Covering. All involved columns included
– MySQL 5.6
• KEY(B,C)
– Range access by B; Filter clause on C only read full row if match
• More cases
– SELECT * …WHERE A=5 and C=6 ; KEY (A,B,C)
• Will scan all index entries with A=5 not all rows
32. How MySQL Picks which Index to Use ?
• The constants in query texts
matter a lot
www.percona.com
Performs dynamic
picking for every
query execution
• by doing “dive” in the table
Estimates number of
rows it needs to
access for given index
• This is what ANALYZE TABLE
updates
Uses “Cardinality”
statistics if impossible
33. www.percona.com
More on Picking the Index
• Looking to minimize the “cost” not query performance
Not Just minimizing
number of scanned
rows
•PRIMARY Key is special for Innodb
•Covering Index benefits
•Full table scan is faster, all being equal
•Can we also use index for Sorting
Lots of other
heuristics and
hacks
•Verify plan MySQL is actually using
•Note it can change dynamically based on constants and data Things to know
34. www.percona.com
Use EXPLAIN
• EXPLAIN is a great tool to see how MySQL
plans to execute the query
– http://dev.mysql.com/doc/refman/5.6/en/using-explain.
html
– Remember real execution might be different
mysql> explain select max(season_nr) from title group by production_year;
+----+-------------+-------+-------+---------------+-----------------+---------+------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+-----------------+---------+------+------+--------------------------+
| 1 | SIMPLE | title | range | NULL | production_year | 5 | NULL | 201 | Using index for group-by |
+----+-------------+-------+-------+---------------+-----------------+---------+------+------+--------------------------+
1 row in set (0.01 sec)
35. www.percona.com
Indexing Strategy
• Look at them together not just one by
one
Build indexes for set of
your performance critical
queries
• At least most selective parts are
Best if all WHERE clause
and JOIN clauses are using
indexes for lookups
• There are some exceptions
Generally extend index if
you can, instead of
creating new indexes
• Revisit Performance of All Queries!
Validate performance
impact as you’re doing
changes
36. www.percona.com
MySQL 5.6 JSON EXPLAIN FORMAT
mysql> EXPLAIN FORMAT=JSON SELECT * FROM t1 JOIN t2 ON t1.i = t2.i WHERE t1.j > 1
AND t2.j < 3;
| {
"query_block": {
"select_id": 1,
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "((`test`.`t1`.`j` > 1) and (`test`.`t1`.`i` is not null))"
} /* table */
},
….
37. www.percona.com
Indexing Strategy Example
• SELECT * FROM TBL WHERE A=5 AND B=6
• SELECT * FROM TBL WHERE A>5 AND B=6
• KEY (B,A) Is better for such query mix
Build Index order
which benefits more
queries
• Do not start with this!
All being equal put
more selective key
part first
• Many indexes slow system down
Do not add indexes
for non performance
critical queries
39. www.percona.com
Trick #1: Enumerating Ranges
• Assume we need to stick to
this order
KEY (A,B)
• Will only use first key part of
the index
SELECT * FROM TBL
WHERE A BETWEEN
2 AND 4 AND B=5
• Will use both key parts
SELECT * FROM TBL
WHERE A IN (2,3,4)
AND B=5
40. www.percona.com
Trick #2: Adding Fake Filter
KEY (GENDER,CITY) • Want to use one index only
• Will not be able to use the index at all SELECT * FROM PEOPLE
WHERE CITY=“NEW YORK”
• Will be able to use the index
SELECT * FROM PEOPLE
WHERE GENDER IN (“M”,”F”)
AND CITY=“NEW YORK”
• Gender, Status, Boolean Types etc The trick works best with low
selectivity columns.
41. www.percona.com
Trick #3: Unionizing Filesort
KEY(A,B) • No Other key would work ether
• Will not be able to use index for
SORTING
SELECT * FROM TBL WHERE A
IN (1,2) ORDER BY B LIMIT 5;
• Will use the index for Sorting. “filesort”
will be needed only to sort over 10 rows.
(SELECT * FROM TBL WHERE
A=1 ORDER BY B LIMIT 5)
UNION ALL (SELECT * FROM
TBL WHERE A=2 ORDER BY B
LIMIT 5) ORDER BY B LIMIT 5;
42. www.percona.com
Thank You !
• pz@percona.com
• http://www.percona.com
• @percona at Twitter
• http://www.facebook.com/Percona