Confoo 2021 presentation on MySQL Indexes, Histograms, and other ways to speed up your queries. This slide deck has slides that may not have been included in the presentation that were omitted due to time constraints
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
Slow query? Add an index or two! But things are suddenly even slower! Indexes are great tools to speed data lookup but have overhead issues. Histograms don’t have that overhead but may not be suited. And how you lock rows also effects performance. So what do you do to speed up queries smartly?
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
This document discusses how to speed up queries in MySQL through the proper use of indexes, histograms, and other techniques. It begins by explaining that the MySQL optimizer tries to determine the most efficient way to execute queries by considering different query plans. The optimizer relies on statistics about column distributions to estimate query costs. The document then discusses using EXPLAIN to view and analyze query plans, and how indexes can improve query performance by allowing faster data retrieval through secondary indexes and other index types. Proper index selection and column data types are important to allow the optimizer to use indexes efficiently.
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
This document discusses various ways to speed up queries in MySQL, including the proper use of indexes, histograms, and locking options. It begins with an introduction to indexes, explaining that indexes are data structures that improve the speed of data retrieval by allowing for faster lookups and access to ordered records. The document then covers different types of indexes like clustered indexes, secondary indexes, functional indexes, and multi-value indexes. It emphasizes choosing indexes carefully based on the most common queries and selecting columns that are not often updated. Overall, the document provides an overview of optimization techniques in MySQL with a focus on index usage.
The document discusses using JSON documents within a relational database. It provides examples of storing JSON documents in MySQL collections and querying them using both document and SQL syntax. Key points include:
- JSON documents can be stored in MySQL collections, providing a flexible document data model while retaining MySQL's reliability and ACID transactions.
- Documents can be queried using either document queries or by converting the JSON to relational form using JSON_TABLE, allowing the use of SQL.
- Examples are shown in several languages for CRUD operations on collections as well as indexing, validation, and more advanced queries like aggregating data from arrays.
- Storing JSON documents natively in MySQL allows leveraging both document and rel
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
Speeding up queries on a MySQL server with indexes and histograms is not a mysterious art but simple engineering. This presentation is an indepth introduction that was presented on March 30th to the Quest Insynch and Open Source 101 conferences
A Step by Step Introduction to the MySQL Document StoreDave Stokes
Looking for a fast, flexible NoSQL document store? And one that runs with the power and reliability of MySQL. This is an intro on how to use the MySQL Document Store
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
The MySQL Shell has a JavaScript mode where you can use JS libraries to access you data and you can also write (and save) your own custom reports (or programs) for future use.
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
MySQL 8.0 has many new features that you probably need to know about but don't. Like default security, window functions, CTEs, CATS (not what you think), JSON_TABLE(), and UTF8MB4 support.
Discover the Power of the NoSQL + SQL with MySQLDave Stokes
Slides from the May th 2020 Webinar on the MySQL Document Store -- please see video examples at https://github.com/davidmstokes/tutorials
Confoo.ca conference talk February 24th 2021 on MySQL new features found in version 8.0 including server and supporting utility updates for those who may have missed some really neat new features
This presentation is an INTRODUCTION to intermediate MySQL query optimization for the Audience of PHP World 2017. It covers some of the more intricate features in a cursory overview.
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
MySQL 8 has many new features and this presentation covers the new data dictionary, improved JSON functions, roles, histograms, and much more. Updated after SunshinePHP 2018 after feedback
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
This document discusses several new features in MySQL 8 including:
1. A new transactional data dictionary that stores metadata instead of files for improved simplicity and crash safety.
2. The addition of histograms to help the query optimizer understand data distributions without indexes for better query planning.
3. Resource groups that allow assigning threads to groups with specific CPU and memory limits to control resource usage.
4. Enhancements to JSON support like in-place updates and new functions for improved flexibility with semi-structured data.
MySQL 8.0 introduces new features like resource groups to dedicate server resources to different query classes. It has a faster backup process using MySQL Shell utilities and compression of replication logs. The presentation provides an overview of InnoDB Cluster which allows multi-primary replication topologies and automated failover using Group Replication. It demonstrates how to easily set up a basic 3 node InnoDB Cluster on the local machine for testing using the MySQL Shell. MySQL Router can then be used to route application connections to the cluster for load balancing and high availability without application changes.
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
MySQL is a relational database management system. The document provides an introduction to MySQL, including:
- MySQL is available in both community and enterprise editions. The community edition is free to use while the enterprise edition starts at $5K/4 core CPU before discounts.
- Data in MySQL is organized into tables within schemas (or databases). Tables contain rows of data organized into columns.
- Structured Query Language (SQL) is used to interact with MySQL databases. Common SQL commands include SELECT to retrieve data, INSERT to add data, UPDATE to modify data, and DELETE to remove data.
- JOIN clauses allow retrieving data from multiple tables by linking them together on common columns. This helps normalize data
MySQL Replication Evolution -- Confoo Montreal 2017Dave Stokes
MySQL Replication has evolved since the early days with simple async master/slave replication with better security, high availability, and now InnoDB Cluster
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadmCloud
The document summarizes the evolution of MySQL from its first release in 1995 to version 8.0 released in 2018. It highlights key features and functionality added over time, including improved performance, Unicode support, spatial data types, window functions, common table expressions, and high availability solutions. The document also briefly mentions Oracle's HeatWave and ColumnStore technologies for handling OLAP/OLTP workloads on MySQL.
MySQL Indexes and Histograms - RMOUG Training Days 2022Dave Stokes
Nobody complains when the database is too fast. But they do gripe when it slows down. The two most popular ways to increase query speed are indexes and histograms. But there a dozens of options for indexes and a lot of lots of bad information on how to use them. Histograms are great but not for all types of data. This session covers the hows and whys of both approaches
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document contains a summary of an Oracle DBA presentation on DBA commands and concepts that every developer should know. The presentation covered topics such as parallel queries, row chaining, explain plans, flashback queries, pending statistics, bulk processing, virtual private databases, extended data types, identity columns, and online table redefinition. It provided examples and demonstrations of many of these commands and concepts.
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
This document provides an overview of new features in Oracle Database 12c for developers and DBAs. It begins with an introduction by Alex Zaballa and then covers several new features including native support for JSON, data redaction, row limits and offsets for SQL queries, PL/SQL functions callable from SQL, session level sequences, and temporary undo. The document includes demonstrations of many of these new features.
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...Alex Zaballa
This document summarizes new features in Oracle Database 12c Release 2 running on Oracle Database Exadata Express Cloud Service. Key features include longer identifier names up to 128 bytes, native support for JSON, improved functions for data conversion errors and LISTAGG, online conversion of non-partitioned tables to partitioned tables, read-only partitions, and approximate query processing. The presentation provides demonstrations of several new features.
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document summarizes a presentation on DBA commands and concepts that every developer should know. The presentation covers topics such as:
- Using SQLcl and tools like dbms_xplan to analyze queries and explain plans
- Leveraging parallelism to improve query performance
- Using flashback queries to view past data states
- Recovering dropped or corrupted tables using flashback and recycle bin features
- Migrating and restoring statistics to support testing and troubleshooting
The presentation provides examples and demonstrations of commands for tasks like analyzing queries, improving performance, recovering data, and managing database metadata.
PostgreSQL (or Postgres) began its life in 1986 as POSTGRES, a research project of the University of California at Berkeley.
PostgreSQL isn't just relational, it's object-relational.it's object-relational. This gives it some advantages over other open source SQL databases like MySQL, MariaDB and Firebird.
The document is an introduction to the MySQL 8.0 optimizer guide. It includes a safe harbor statement noting that the guide outlines Oracle's general product direction but not commitments. The agenda lists 25 topics to be covered related to query optimization, diagnostic commands, examples from the "World Schema" sample database, and a companion website with more details.
What Your Database Query is Really DoingDave Stokes
Do you ever wonder what your database servers is REALLY doing with that query you just wrote. This is a high level overview of the process of running a query
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
The MySQL Shell has a JavaScript mode where you can use JS libraries to access you data and you can also write (and save) your own custom reports (or programs) for future use.
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
MySQL 8.0 has many new features that you probably need to know about but don't. Like default security, window functions, CTEs, CATS (not what you think), JSON_TABLE(), and UTF8MB4 support.
Discover the Power of the NoSQL + SQL with MySQLDave Stokes
Slides from the May th 2020 Webinar on the MySQL Document Store -- please see video examples at https://github.com/davidmstokes/tutorials
Confoo.ca conference talk February 24th 2021 on MySQL new features found in version 8.0 including server and supporting utility updates for those who may have missed some really neat new features
This presentation is an INTRODUCTION to intermediate MySQL query optimization for the Audience of PHP World 2017. It covers some of the more intricate features in a cursory overview.
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
MySQL 8 has many new features and this presentation covers the new data dictionary, improved JSON functions, roles, histograms, and much more. Updated after SunshinePHP 2018 after feedback
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
This document discusses several new features in MySQL 8 including:
1. A new transactional data dictionary that stores metadata instead of files for improved simplicity and crash safety.
2. The addition of histograms to help the query optimizer understand data distributions without indexes for better query planning.
3. Resource groups that allow assigning threads to groups with specific CPU and memory limits to control resource usage.
4. Enhancements to JSON support like in-place updates and new functions for improved flexibility with semi-structured data.
MySQL 8.0 introduces new features like resource groups to dedicate server resources to different query classes. It has a faster backup process using MySQL Shell utilities and compression of replication logs. The presentation provides an overview of InnoDB Cluster which allows multi-primary replication topologies and automated failover using Group Replication. It demonstrates how to easily set up a basic 3 node InnoDB Cluster on the local machine for testing using the MySQL Shell. MySQL Router can then be used to route application connections to the cluster for load balancing and high availability without application changes.
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
MySQL is a relational database management system. The document provides an introduction to MySQL, including:
- MySQL is available in both community and enterprise editions. The community edition is free to use while the enterprise edition starts at $5K/4 core CPU before discounts.
- Data in MySQL is organized into tables within schemas (or databases). Tables contain rows of data organized into columns.
- Structured Query Language (SQL) is used to interact with MySQL databases. Common SQL commands include SELECT to retrieve data, INSERT to add data, UPDATE to modify data, and DELETE to remove data.
- JOIN clauses allow retrieving data from multiple tables by linking them together on common columns. This helps normalize data
MySQL Replication Evolution -- Confoo Montreal 2017Dave Stokes
MySQL Replication has evolved since the early days with simple async master/slave replication with better security, high availability, and now InnoDB Cluster
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadmCloud
The document summarizes the evolution of MySQL from its first release in 1995 to version 8.0 released in 2018. It highlights key features and functionality added over time, including improved performance, Unicode support, spatial data types, window functions, common table expressions, and high availability solutions. The document also briefly mentions Oracle's HeatWave and ColumnStore technologies for handling OLAP/OLTP workloads on MySQL.
MySQL Indexes and Histograms - RMOUG Training Days 2022Dave Stokes
Nobody complains when the database is too fast. But they do gripe when it slows down. The two most popular ways to increase query speed are indexes and histograms. But there a dozens of options for indexes and a lot of lots of bad information on how to use them. Histograms are great but not for all types of data. This session covers the hows and whys of both approaches
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document contains a summary of an Oracle DBA presentation on DBA commands and concepts that every developer should know. The presentation covered topics such as parallel queries, row chaining, explain plans, flashback queries, pending statistics, bulk processing, virtual private databases, extended data types, identity columns, and online table redefinition. It provided examples and demonstrations of many of these commands and concepts.
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
This document provides an overview of new features in Oracle Database 12c for developers and DBAs. It begins with an introduction by Alex Zaballa and then covers several new features including native support for JSON, data redaction, row limits and offsets for SQL queries, PL/SQL functions callable from SQL, session level sequences, and temporary undo. The document includes demonstrations of many of these new features.
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...Alex Zaballa
This document summarizes new features in Oracle Database 12c Release 2 running on Oracle Database Exadata Express Cloud Service. Key features include longer identifier names up to 128 bytes, native support for JSON, improved functions for data conversion errors and LISTAGG, online conversion of non-partitioned tables to partitioned tables, read-only partitions, and approximate query processing. The presentation provides demonstrations of several new features.
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document summarizes a presentation on DBA commands and concepts that every developer should know. The presentation covers topics such as:
- Using SQLcl and tools like dbms_xplan to analyze queries and explain plans
- Leveraging parallelism to improve query performance
- Using flashback queries to view past data states
- Recovering dropped or corrupted tables using flashback and recycle bin features
- Migrating and restoring statistics to support testing and troubleshooting
The presentation provides examples and demonstrations of commands for tasks like analyzing queries, improving performance, recovering data, and managing database metadata.
PostgreSQL (or Postgres) began its life in 1986 as POSTGRES, a research project of the University of California at Berkeley.
PostgreSQL isn't just relational, it's object-relational.it's object-relational. This gives it some advantages over other open source SQL databases like MySQL, MariaDB and Firebird.
The document is an introduction to the MySQL 8.0 optimizer guide. It includes a safe harbor statement noting that the guide outlines Oracle's general product direction but not commitments. The agenda lists 25 topics to be covered related to query optimization, diagnostic commands, examples from the "World Schema" sample database, and a companion website with more details.
What Your Database Query is Really DoingDave Stokes
Do you ever wonder what your database servers is REALLY doing with that query you just wrote. This is a high level overview of the process of running a query
MySQL 8.0 is a big advancement over previous versions with a true data dictionary, invisible indexes, histograms, windowing functions, improved JSON support, CATS, and more
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)Dave Stokes
MySQL has many new features including a true data dictionary, better JSON support, histograms, roles, true descending indexes, 3d GIS, invisible indexes, and the default character set is UTF8MB4
This document discusses randomizing data in Microsoft SQL Server. It explains how to generate unique identifiers (GUIDs) to randomize data, create a temporary table to insert randomized data, and display results randomly ordered by the GUID field. Examples are provided of inserting a subset of user data from Stack Overflow based on location into a temporary table, and displaying 10 random records from that table. The randomized results could be useful for applications like jury selection, assigning volunteers, or selecting employees for training.
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().
How to analyze and tune sql queries for better performance vts2016oysteing
This document provides an agenda and overview for a presentation on analyzing and tuning MySQL queries for better performance. The presentation covers topics like cost-based query optimization in MySQL, tools for monitoring queries, index selection, the join optimizer, and influencing the optimizer. It also provides examples of using tools like the performance schema, EXPLAIN, and optimizer traces to analyze query performance.
MySQL 8 - UKOUG Techfest Brighton December 2nd, 2019Dave Stokes
The document discusses several new features in MySQL 8 including:
1. A new data dictionary that stores metadata internally instead of external files, allowing for transactional ALTER TABLE commands.
2. Support for common table expressions and windowing functions.
3. Improvements to the optimizer including index and join order hints, descending indexes, and optimizer trace output providing more details.
4. Support for roles which are named collections of privileges that can be assigned to users.
5. UTF8MB4 is now the default character set providing support for emoji and supplementary characters.
6. Ability to create invisible indexes that are not used by the optimizer but are maintained for testing performance impact.
Antes de migrar de 10g a 11g o 12c, tome en cuenta las siguientes consideraciones. No es tan sencillo como simplemente cambiar de motor de base de datos, se necesita hacer consideraciones a nivel del aplicativo.
The thinking persons guide to data warehouse designCalpont
The document discusses key considerations for designing a data warehouse, including building a logical design, transitioning to a physical design, and monitoring and tuning the design. It recommends using a modeling tool to capture logical designs, manual partitioning in some cases, and letting database engines do the work. It also covers physical design decisions like SQL vs NoSQL, row vs column storage, partitioning, indexing and optimizing data loads. Regular monitoring of workloads, bottlenecks and ratios is advised to tune performance.
MySQL 5.7 Tutorial Dutch PHP Conference 2015Dave Stokes
MySQL 5.7 is the latest version of the MySQL database. It includes new features such as support for JSON as a native data type with functions for manipulating JSON documents. Security has also been improved with secure defaults, password rotation/expiration controls, and SSL encryption enabled by default for the C client library. The release candidate for 5.7 was released in April 2015 and includes patches, contributions, and enhancements over previous versions.
MySQL 5.7. Tutorial - Dutch PHP Conference 2015Dave Stokes
MySQL 5.7 is the latest version of the MySQL database. It includes new features such as support for JSON as a native data type with functions for manipulating JSON documents. Security has also been improved with secure defaults, password rotation/expiration controls, and SSL encryption enabled by default for the C client library. The release candidate for 5.7 was released in April 2015 and includes patches, contributions, and enhancements over previous versions.
The document discusses new features and improvements in the MySQL 8.0 optimizer. Key highlights include:
- New SQL syntax like SELECT...FOR UPDATE SKIP LOCKED and NOWAIT to handle row locking contention.
- Support for common table expressions to improve readability and allow referencing derived tables multiple times.
- Enhancements to the cost model to produce more accurate estimates based on factors like data location.
- Better support for data types like UUID and IPv6, including optimized storage formats and new functions.
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...Cynthia Saracco
Got Big Data? Then check out what Big SQL can do for you . . . . Learn how IBM's industry-standard SQL interface enables you to leverage your existing SQL skills to query, analyze, and manipulate data managed in an Apache Hadoop environment on cloud or on premise. This quick technical tour is filled with practical examples designed to get you started working with Big SQL in no time. Specifically, you'll learn how to create Big SQL tables over Hadoop data in HDFS, Hive, or HBase; populate Big SQL tables with data from HDFS, a remote file system, or a remote RDBMS; execute simple and complex Big SQL queries; work with non-traditional data formats and more. These charts are for session ALB-3663 at the IBM World of Watson 2016 conference.
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.
Don't optimize my queries, organize my data!Julian Hyde
Your queries won't run fast if your data is not organized right. Apache Calcite optimizes queries, but can we make it optimize data? We had to solve several challenges. Users are too busy to tell us the structure of their database, and the query load changes daily, so Calcite has to learn and adapt. We talk about new algorithms we developed for gathering statistics on massive database, and how we infer and evolve the data model based on the queries.
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.
Database basics for new-ish developers -- All Things Open October 18th 2021Dave Stokes
Do you wonder why it takes your database to find the top five of your fifty six million customers? Do you really have a good idea of what NULL is and how to use it? And why are some database queries so quick and others frustratingly slow? Relational databases have been around for over fifty years and frustrating developers for at least forty nine of those years. This session is an attempt to explain why sometimes the database seems very fast and other times not. You will learn how to set up data (normalization) to avoid redundancies into tables by their function, how to join two tables to combine data, and why Structured Query Language is so very different than most other languages. And you will see how thinking in sets over records can greatly improve your life with a database.
Validating JSON -- Percona Live 2021 presentationDave Stokes
JSON is a free form data exchange format which can cause problems when combined with a strictly typed relational database. Thanks to the folks at https://json-schema.org and the MySQL engineers at Oracle we can no specify required fields, type checks, and range checks.
Data Love Conference - Window Functions for Database AnalyticsDave Stokes
16 April 2021 presentation for the Data Love Conference on Window Functions for Data Base Analytics. Examples are on MySQL but will work for other RDMS's with window functions. Assumes no user background on window functions or analytics
Discover The Power of NoSQL + MySQL with MySQLDave Stokes
The document discusses the MySQL Document Store, which provides both NoSQL and SQL capabilities on a single platform. It allows for schemaless document storage and querying using JSON documents, while also providing the reliability, security and transaction support of MySQL. Examples are given in several programming languages of basic CRUD operations on document collections using simple APIs that avoid the need for SQL. The document also shows how JSON documents can be queried using SQL/JSON functions, enabling more complex analysis that was previously only possible in a relational database. This provides the best aspects of both NoSQL and SQL on a proven database platform.
Confoo 202 - MySQL Group Replication and ReplicaSetDave Stokes
MySQL Group Replication, ReplicaSet, & Architectures outlines MySQL's general product direction for high availability and replication. It provides an overview of Group Replication, ReplicaSet, and related components like MySQL Shell and MySQL Router. Key capabilities discussed include automated setup and management, integrated load balancing, and both asynchronous and synchronous replication options. Limitations noted include the requirement for manual failover in ReplicaSet deployments.
MySQL New Features -- Sunshine PHP 2020 PresentationDave Stokes
MySQL has moved to a quarterly release cycle and it can be hard to keep up with the new features. For instance, there are now multi-valued indexes for things like JSON arrays to allow for fast searches of embedded data. And there is a bulk loaded for JSON, CSV, and TSV data that works in parallel. Or support for JSON-Schame.org's JSON schema validation. Plus you no longer need to run mysql_upgrade after an upgrade as that is all automated. In addition, you can now clone InnoDB tablespaces for fast initialization of replicate data. So if you need to catch up on the latest and greatest from MySQL you need to be in this session.
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Dave Stokes
- The document discusses upgrading from MySQL 5.7 to MySQL 8.0, providing guidance on the upgrade path and process.
- It describes running checks using the new MySQL Shell utility to detect any issues in the 5.7 instance that need addressing before upgrading, such as incompatible syntax, removed features, or changed defaults.
- Advice is given on backup procedures, reading the upgrade documentation, and addressing any warnings or errors reported by the upgrade checker to ensure a smooth transition.
Windowing Functions - Little Rock Tech Fest 2019Dave Stokes
The document outlines Oracle's general product direction but notes that it is non-binding and subject to change. It also contains standard legal disclaimers regarding forward-looking statements and refers readers to Oracle's SEC filings for risks associated with its business and products.
Oracle CodeOne Foreign Keys Support in MySQL 8.0Dave Stokes
The document discusses foreign key support in MySQL 8.0. Foreign keys allow cross-referencing of related data across tables and help enforce referential integrity. Before MySQL 8.0, foreign key metadata was stored in storage engines rather than a centralized data dictionary. MySQL 8.0 has moved to storing foreign keys in a new centralized data dictionary, improving features like DDL handling, information schema queries, and metadata locking. Future plans include moving cascading actions to the SQL layer and improving syntax support.
MySQL Without the SQL - Oh My! August 2nd presentation at Mid Atlantic Develo...Dave Stokes
MySQL Document Store allows you to use MySQL as a JSON Document Databases without needing to set up relational tables, normalize data, or use Structured Query Language.
MySQL 8.0 Graphical Information System - Mid Atlantic Developers ConferenceDave Stokes
The document discusses the evolution of MySQL's support for graphical information systems (GIS) from using self-written libraries in versions prior to 5.7, to incorporating Boost geometry libraries in 5.7 for 2D and adding 3D support in 8.0. It provides examples of using spatial data types like POINT, LINESTRING, and POLYGON with functions like ST_GeomFromText to insert geometry values. It also covers spatial reference systems (SRIDs) and formats like Well Known Text (WKT) and Well Known Binary (WKB).
Technology Trends in 2025: AI and Big Data AnalyticsInData Labs
At InData Labs, we have been keeping an ear to the ground, looking out for AI-enabled digital transformation trends coming our way in 2025. Our report will provide a look into the technology landscape of the future, including:
-Artificial Intelligence Market Overview
-Strategies for AI Adoption in 2025
-Anticipated drivers of AI adoption and transformative technologies
-Benefits of AI and Big data for your business
-Tips on how to prepare your business for innovation
-AI and data privacy: Strategies for securing data privacy in AI models, etc.
Download your free copy nowand implement the key findings to improve your business.
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...SOFTTECHHUB
I started my online journey with several hosting services before stumbling upon Ai EngineHost. At first, the idea of paying one fee and getting lifetime access seemed too good to pass up. The platform is built on reliable US-based servers, ensuring your projects run at high speeds and remain safe. Let me take you step by step through its benefits and features as I explain why this hosting solution is a perfect fit for digital entrepreneurs.
HCL Nomad Web – Best Practices and Managing Multiuser Environmentspanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-and-managing-multiuser-environments/
HCL Nomad Web is heralded as the next generation of the HCL Notes client, offering numerous advantages such as eliminating the need for packaging, distribution, and installation. Nomad Web client upgrades will be installed “automatically” in the background. This significantly reduces the administrative footprint compared to traditional HCL Notes clients. However, troubleshooting issues in Nomad Web present unique challenges compared to the Notes client.
Join Christoph and Marc as they demonstrate how to simplify the troubleshooting process in HCL Nomad Web, ensuring a smoother and more efficient user experience.
In this webinar, we will explore effective strategies for diagnosing and resolving common problems in HCL Nomad Web, including
- Accessing the console
- Locating and interpreting log files
- Accessing the data folder within the browser’s cache (using OPFS)
- Understand the difference between single- and multi-user scenarios
- Utilizing Client Clocking
Spark is a powerhouse for large datasets, but when it comes to smaller data workloads, its overhead can sometimes slow things down. What if you could achieve high performance and efficiency without the need for Spark?
At S&P Global Commodity Insights, having a complete view of global energy and commodities markets enables customers to make data-driven decisions with confidence and create long-term, sustainable value. 🌍
Explore delta-rs + CDC and how these open-source innovations power lightweight, high-performance data applications beyond Spark! 🚀
Procurement Insights Cost To Value Guide.pptxJon Hansen
Procurement Insights integrated Historic Procurement Industry Archives, serves as a powerful complement — not a competitor — to other procurement industry firms. It fills critical gaps in depth, agility, and contextual insight that most traditional analyst and association models overlook.
Learn more about this value- driven proprietary service offering here.
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfAbi john
Analyze the growth of meme coins from mere online jokes to potential assets in the digital economy. Explore the community, culture, and utility as they elevate themselves to a new era in cryptocurrency.
Semantic Cultivators : The Critical Future Role to Enable AIartmondano
By 2026, AI agents will consume 10x more enterprise data than humans, but with none of the contextual understanding that prevents catastrophic misinterpretations.
Dev Dives: Automate and orchestrate your processes with UiPath MaestroUiPathCommunity
This session is designed to equip developers with the skills needed to build mission-critical, end-to-end processes that seamlessly orchestrate agents, people, and robots.
📕 Here's what you can expect:
- Modeling: Build end-to-end processes using BPMN.
- Implementing: Integrate agentic tasks, RPA, APIs, and advanced decisioning into processes.
- Operating: Control process instances with rewind, replay, pause, and stop functions.
- Monitoring: Use dashboards and embedded analytics for real-time insights into process instances.
This webinar is a must-attend for developers looking to enhance their agentic automation skills and orchestrate robust, mission-critical processes.
👨🏫 Speaker:
Andrei Vintila, Principal Product Manager @UiPath
This session streamed live on April 29, 2025, 16:00 CET.
Check out all our upcoming Dev Dives sessions at https://community.uipath.com/dev-dives-automation-developer-2025/.
How Can I use the AI Hype in my Business Context?Daniel Lehner
𝙄𝙨 𝘼𝙄 𝙟𝙪𝙨𝙩 𝙝𝙮𝙥𝙚? 𝙊𝙧 𝙞𝙨 𝙞𝙩 𝙩𝙝𝙚 𝙜𝙖𝙢𝙚 𝙘𝙝𝙖𝙣𝙜𝙚𝙧 𝙮𝙤𝙪𝙧 𝙗𝙪𝙨𝙞𝙣𝙚𝙨𝙨 𝙣𝙚𝙚𝙙𝙨?
Everyone’s talking about AI but is anyone really using it to create real value?
Most companies want to leverage AI. Few know 𝗵𝗼𝘄.
✅ What exactly should you ask to find real AI opportunities?
✅ Which AI techniques actually fit your business?
✅ Is your data even ready for AI?
If you’re not sure, you’re not alone. This is a condensed version of the slides I presented at a Linkedin webinar for Tecnovy on 28.04.2025.
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveScyllaDB
Want to learn practical tips for designing systems that can scale efficiently without compromising speed?
Join us for a workshop where we’ll address these challenges head-on and explore how to architect low-latency systems using Rust. During this free interactive workshop oriented for developers, engineers, and architects, we’ll cover how Rust’s unique language features and the Tokio async runtime enable high-performance application development.
As you explore key principles of designing low-latency systems with Rust, you will learn how to:
- Create and compile a real-world app with Rust
- Connect the application to ScyllaDB (NoSQL data store)
- Negotiate tradeoffs related to data modeling and querying
- Manage and monitor the database for consistently low latencies
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersToradex
Toradex brings robust Linux support to SMARC (Smart Mobility Architecture), ensuring high performance and long-term reliability for embedded applications. Here’s how:
• Optimized Torizon OS & Yocto Support – Toradex provides Torizon OS, a Debian-based easy-to-use platform, and Yocto BSPs for customized Linux images on SMARC modules.
• Seamless Integration with i.MX 8M Plus and i.MX 95 – Toradex SMARC solutions leverage NXP’s i.MX 8 M Plus and i.MX 95 SoCs, delivering power efficiency and AI-ready performance.
• Secure and Reliable – With Secure Boot, over-the-air (OTA) updates, and LTS kernel support, Toradex ensures industrial-grade security and longevity.
• Containerized Workflows for AI & IoT – Support for Docker, ROS, and real-time Linux enables scalable AI, ML, and IoT applications.
• Strong Ecosystem & Developer Support – Toradex offers comprehensive documentation, developer tools, and dedicated support, accelerating time-to-market.
With Toradex’s Linux support for SMARC, developers get a scalable, secure, and high-performance solution for industrial, medical, and AI-driven applications.
Do you have a specific project or application in mind where you're considering SMARC? We can help with Free Compatibility Check and help you with quick time-to-market
For more information: https://www.toradex.com/computer-on-modules/smarc-arm-family
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...Alan Dix
Talk at the final event of Data Fusion Dynamics: A Collaborative UK-Saudi Initiative in Cybersecurity and Artificial Intelligence funded by the British Council UK-Saudi Challenge Fund 2024, Cardiff Metropolitan University, 29th April 2025
https://alandix.com/academic/talks/CMet2025-AI-Changes-Everything/
Is AI just another technology, or does it fundamentally change the way we live and think?
Every technology has a direct impact with micro-ethical consequences, some good, some bad. However more profound are the ways in which some technologies reshape the very fabric of society with macro-ethical impacts. The invention of the stirrup revolutionised mounted combat, but as a side effect gave rise to the feudal system, which still shapes politics today. The internal combustion engine offers personal freedom and creates pollution, but has also transformed the nature of urban planning and international trade. When we look at AI the micro-ethical issues, such as bias, are most obvious, but the macro-ethical challenges may be greater.
At a micro-ethical level AI has the potential to deepen social, ethnic and gender bias, issues I have warned about since the early 1990s! It is also being used increasingly on the battlefield. However, it also offers amazing opportunities in health and educations, as the recent Nobel prizes for the developers of AlphaFold illustrate. More radically, the need to encode ethics acts as a mirror to surface essential ethical problems and conflicts.
At the macro-ethical level, by the early 2000s digital technology had already begun to undermine sovereignty (e.g. gambling), market economics (through network effects and emergent monopolies), and the very meaning of money. Modern AI is the child of big data, big computation and ultimately big business, intensifying the inherent tendency of digital technology to concentrate power. AI is already unravelling the fundamentals of the social, political and economic world around us, but this is a world that needs radical reimagining to overcome the global environmental and human challenges that confront us. Our challenge is whether to let the threads fall as they may, or to use them to weave a better future.
Artificial Intelligence is providing benefits in many areas of work within the heritage sector, from image analysis, to ideas generation, and new research tools. However, it is more critical than ever for people, with analogue intelligence, to ensure the integrity and ethical use of AI. Including real people can improve the use of AI by identifying potential biases, cross-checking results, refining workflows, and providing contextual relevance to AI-driven results.
News about the impact of AI often paints a rosy picture. In practice, there are many potential pitfalls. This presentation discusses these issues and looks at the role of analogue intelligence and analogue interfaces in providing the best results to our audiences. How do we deal with factually incorrect results? How do we get content generated that better reflects the diversity of our communities? What roles are there for physical, in-person experiences in the digital world?
Generative Artificial Intelligence (GenAI) in BusinessDr. Tathagat Varma
My talk for the Indian School of Business (ISB) Emerging Leaders Program Cohort 9. In this talk, I discussed key issues around adoption of GenAI in business - benefits, opportunities and limitations. I also discussed how my research on Theory of Cognitive Chasms helps address some of these issues
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul
Artificial intelligence is changing how businesses operate. Companies are using AI agents to automate tasks, reduce time spent on repetitive work, and focus more on high-value activities. Noah Loul, an AI strategist and entrepreneur, has helped dozens of companies streamline their operations using smart automation. He believes AI agents aren't just tools—they're workers that take on repeatable tasks so your human team can focus on what matters. If you want to reduce time waste and increase output, AI agents are the next move.
5. What Is This Session About?
Nobody ever complains that the database is too fast!
Speeding up queries is not a ‘dark art’
But understanding how to speed up queries is often
treated as magic
So we will be looking at the proper use of indexes,
histograms, locking options, and some other ways to speed
queries up.
5
6. Yes, this is a very dry subject!
● How dry?
○ Very dry
● Lots of text on screen
○ Download slides and use as a reference later
■ slideshare.net/davidmstokes
○ Do not try to absorb all at once
■ Work on most frequent query first, then second most, …
■ And optimizations may need to change over time
● No Coverage today of
○ System configuration
■ OS
■ MySQL
○ Hardware
○ Networking Slides are posted to https://slideshare.net/davestokes 6
7. Normalize Your Data (also not covered today)
● Can not build a skyscraper on a foundation of sand
● Third normal form or better
○ Use JSON for ‘stub’ table data, avoiding
repeated unneeded index/table accesses
● Think about how you will use your data
○ Do not use a fork to eat soup; How do you consume your data
Badly normalized data will hurt the performance of your queries. No matter
how much training you give it, a dachshund will not be faster than a thoroughbred
horse!
7
8. The Optimizer
● Consider the optimizer the brain and
nervous system of the system.
● Query optimization is a feature of
many relational database
management systems.
● The query optimizer attempts to
determine the most efficient way to
execute a given query by considering
the possible query plans. Wikipedia
8
One of the hardest problems in query optimization is to
accurately estimate the costs of alternative query plans.
Optimizers cost query plans using a mathematical model
of query execution costs that relies heavily on estimates
of the cardinality, or number of tuples, flowing through
each edge in a query plan.
Cardinality estimation in turn depends on estimates of
the selection factor of predicates in the query.
Traditionally, database systems estimate selectivities
through fairly detailed statistics on the distribution of
values in each column, such as histograms.
9. The query optimizer evaluates the options
● The optimizer wants to get your data the
cheapest way (least amount of very
expensive disk reads) possible.
● Like a GPS, the cost is built on historical
statistics. And these statistics can
change while the optimizer is working. So
like a traffic jam, washed out road, or other
traffic problem, the optimizer may be
making poor decisions for the present
situation.
● The final determination from the optimizer
is call the query plan.
● MySQL wants to optimize each query
every time it sees it – there is no locking
down the query plan like Oracle.
{watch for optimizer hints later in this
presentation}
You will see how to obtain a query plan
later in this presentation.
9
10. 120!
If your query has five joins then the optimizer
may have to evaluate 120 different options
5!
(5 * 4 * 3 * 2 * 1)
10
12. EXPLAIN Syntax
12
Query optimization is covered in
Chapter 8 of the MySQL Manual
EXPLAIN reports how the
server would process the
statement, including information
about how tables are joined and
in which order.
13. But now for something completely different
The tools for looking at queries
● EXPLAIN
○ EXPLAIN FORMAT=
■ JSON
■ TREE
○ ANALYZE
● VISUAL EXPLAIN 13
14. EXPLAIN Example
14
EXPLAIN is used to obtain a query execution plan (an explanation of how MySQL would
execute a query) and should be considered an ESTIMATE as it does not run the query.
QUERY
QUERY PLAN
DETAILS
18. EXPLAIN ANALYZE – MySQL 8.0.18
18
EXPLAIN ANALYZE SELECT * FROM City WHERE CountryCode = 'GBR'G
*************************** 1. row ***************************
EXPLAIN: -> Index lookup on City using CountryCode (CountryCode='GBR')
(cost=80.76 rows=81) (actual time=0.153..0.178 rows=81 loops=1)
1 row in set (0.0008 sec)
MySQL 8.0.18 introduced EXPLAIN ANALYZE, which runs the query and produces
EXPLAIN output along with timing and additional, iterator-based, information about how the
optimizer's expectations matched the actual execution. Real numbers not an estimate!
21. Indexes
A database index is a data structure that improves the speed of data retrieval
operations on a database table at the cost of additional writes and storage space
to maintain the index data structure.
Indexes are used to quickly locate data without having to search every row in a
database table every time a database table is accessed.
Indexes can be created using one or more columns of a database table, providing
the basis for both rapid random lookups and efficient access of ordered records. -
- https://en.wikipedia.org/wiki/Database_index
21
22. Think of an Index as a Table
With Shortcuts to another
table!
Or a model of some of your data in it’s own table!
And the more tables you have the read to get to
the data the slower things run!
(And the more memory is taken up) 22
25. 25
clustered index
The InnoDB term for a primary key index. InnoDB table storage is organized based on the values of the primary key columns,
to speed up queries and sorts involving the primary key columns.
For best performance, choose the primary key columns carefully based on the most performance-critical queries.
Because modifying the columns of the clustered index is an expensive operation, choose primary columns that are rarely or
never updated.
In the Oracle Database product, this type of table is known as an index-organized table
26. Think of an index as a small, fast table pointing to a bigger table
26
Index
3
6
12
27
5001
Indexed Column column 1 column x column n
5001
3
6
27
12
27. How Secondary Indexes Relate to the Clustered Index
All indexes other than the clustered index are known as secondary indexes.
In InnoDB, each record in a secondary index contains the primary key columns for the row, as well as
the columns specified for the secondary index. InnoDB uses this primary key value to search for the row
in the clustered index.
If the primary key is long, the secondary indexes use more space, so it is advantageous to have a short
primary key.
27
28. 28
Creating a table with a PRIMARY KEY (index)
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 VARCHAR(100),
c3 VARCHAR(100) );
An index is a list of KEYs.
And you will hear ‘key’ and ‘index’ used interchangeably
29. PRIMARY KEY
This is an key for the index that uniquely defined for a row, should be immutable.
InnoDB needs a PRIMARY KEY (and will make one up if you do not specify)
No Null Values
Monotonically increasing
- use UUID_To_BIN() if you must use UUIDS, otherwise avoid them
29
30. Indexing on a prefix of a column
CREATE INDEX part_of_name ON customer (name(10));
Only the first 10 characters are indexed in this examples and
this can save space/speed
30
31. Multi-column index - last_name, first_name
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
31
This index will work on (last_name,first_name) and (last_name) but not (first_name)
{Use: left to right}
Put highest cardinality field first
32. Hashing values - an alternative
SELECT * FROM tbl_name
WHERE hash_col=MD5(CONCAT(val1,val2))
AND col1=val1 AND col2=val2;
As an alternative to a composite index, you can introduce a
column that is “hashed” based on information from other columns.
If this column is short, reasonably unique, and indexed, it
might be faster than a “wide” index on many columns.
32
33. Some other types of indexes
Unique Indexes - only one row per value
Full-Text Indexes - search string data
Covering index - includes all columns needed for a query
Secondary index - another column in the table is indexes
Spatial Indexes - geographical information
33
34. Functional Indexes are defined on the result of a function
applied to one or more columns of a single table
CREATE TABLE t1 (col1 INT, col2 INT, INDEX func_index ((ABS(col1))));
CREATE INDEX idx1 ON t1 ((col1 + col2));
CREATE INDEX idx2 ON t1 ((col1 + col2), (col1 - col2), col1);
ALTER TABLE t1 ADD INDEX ((col1 * 40) DESC);
34
35. Multi-value indexes
You can now have more index pointers than index keys!
○ Very useful for JSON arrays
mysql> SELECT 3 MEMBER OF('[1, 3, 5, 7, "Moe"]');
+--------------------------------------+
| 3 MEMBER OF('[1, 3, 5, 7, "Moe"]') |
+--------------------------------------+
| 1 |
+--------------------------------------+
35
36. MySQL has Two Main Types of Index Structures
B-Tree is a self-balancing tree data structure
that maintains sorted data and allows searches,
sequential access, insertions, and deletions.
36
Hash are more efficient than nested loops joins,
except when the probe side of the join is very
small but joins can only be used to compute
equijoins.
37. Please Keep in mind ...
If there is a choice between multiple indexes, MySQL normally uses the index that
finds the smallest number of rows (the most selective index).
MySQL can use indexes on columns more efficiently if they are declared as the
same type and size.
● In this context, VARCHAR and CHAR are considered the same if they are
declared as the same size. For example, VARCHAR(10) and CHAR(10) are
the same size, but VARCHAR(10) and CHAR(15) are not.
For comparisons between nonbinary string columns, both columns should use the
same character set. For example, comparing a utf8 column with a latin1 column
precludes use of an index. 37
42. Before Invisible Indexes
1. Doubt usefulness of index
2. Check using EXPLAIN
3. Remove that Index
4. Rerun EXPLAIN
5. Get phone/text/screams from power user about slow query
6. Suddenly realize that the index in question may have had no use for you but
the rest of the planet seems to need that dang index!
7. Take seconds/minutes/hours/days/weeks rebuilding that index
42
43. After Invisible Indexes
1. Doubt usefulness of index
2. Check using EXPLAIN
3. Make index invisible – optimizer can not see that index!
4. Rerun EXPLAIN
5. Get phone/text/screams from power user about slow query
6. Make index visible
7. Blame problem on { network | JavaScript | GDPR | Slack | Cloud }
Sys schema will show you which indexes have not been used that may be
candidates for removal -- but be cautious!
43
44. How to use INVISIBLE INDEX
ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE;
ALTER TABLE t1 ALTER INDEX i_idx VISIBLE;
44
45. Histograms
What is a histogram?
It is not a gluten free, keto friendly biscuit.
45
47. Histograms
What is a histogram?
Wikipedia declares a histogram is an accurate representation of the distribution of
numerical data. For RDBMS, a histogram is an approximation of the data
distribution within a specific column.
So in MySQL, histograms help the optimizer to find the most efficient Query Plan
to fetch that data.
47
48. Histograms
What is a histogram?
A histogram is a distribution of data into logical buckets.
There are two types:
● Singleton
● Equi-Height
Maximum number of buckets is 1024
48
49. Histogram
Histogram statistics are useful primarily for non-indexed columns.
A histogram is created or updated only on demand, so it adds no
overhead when table data is modified. On the other hand, the statistics become
progressively more out of date when table modifications occur, until the next time
they are updated.
49
50. The two reasons for why you might consider a histogram instead of an index:
Maintaining an indexes have a cost. If you have an index, every
● Every INSERT/UPDATE/DELETE causes the index to be updated. This will
have an impact on your performance. A histogram on the other hand is
created once and never updated unless you explicitly ask for it. It will thus not
hurt your INSERT/UPDATE/DELETE-performance.
● The optimizer will make “index dives” to estimate the number of records in a
given range. This might become too costly if you have for instance very long
IN-lists in your query. Histogram statistics are much cheaper in this case, and
might thus be more suitable.
50
51. The Optimizer
Occasionally the query optimizer fails to find the most efficient plan and ends up
spending a lot more time executing the query than necessary.
The optimizer assumes that the data is evenly distributed in the column. This can
be the old ‘assume’ makes an ‘ass out of you and me’ joke brought to life.
The main reason for this is often that the optimizer doesn’t have enough
knowledge about the data it is about to query:
● How many rows are there in each table?
● How many distinct values are there in each column?
● How is the data distributed in each column?
51
52. Two-types of histograms
Equi-height: One bucket represents a range of values. This type of histogram will
be created when distinct values in the column are greater than the number of
buckets specified in the analyze table syntax. Think A-G H-L M-T U-Z
Singleton: One bucket represents one single value in the column and is the most
accurate and will be created when the number of distinct values in the column is
less than or equal to the number of buckets specified in the analyze table syntax.
52
56. Creating and removing Histograms
ANALYZE TABLE t UPDATE HISTOGRAM ON c1, c2, c3 WITH 10 BUCKETS;
ANALYZE TABLE t UPDATE HISTOGRAM ON c1, c3 WITH 10 BUCKETS;
ANALYZE TABLE t DROP HISTOGRAM ON c2;
Note the first statement creates three different histograms on c1, c2, and c3.
56
57. Information about Histograms
mysql> SELECT TABLE_NAME, COLUMN_NAME,
HISTOGRAM->>'$."data-type"' AS 'data-type',
JSON_LENGTH(HISTOGRAM->>'$."buckets"') AS 'bucket-count'
FROM INFORMATION_SCHEMA.COLUMN_STATISTICS;
+-----------------+-------------+-----------+--------------+
| TABLE_NAME | COLUMN_NAME | data-type | bucket-count |
+-----------------+-------------+-----------+--------------+
| country | Population | int | 226 |
| city | Population | int | 1024 |
| countrylan | Language | string | 457 |
+-----------------+-------------+-----------+--------------+
57
58. Where Histograms Shine
create table h1 (id int unsigned auto_increment,
x int unsigned, primary key(id));
insert into h1 (x) values (1),(1),(2),(2),(2),(3),(3),(3),(3);
select x, count(x) from h1 group by x;
+---+----------+
| x | count(x) |
+---+----------+
| 1 | 2 |
| 2 | 3 |
| 3 | 4 |
+---+----------+
3 rows in set (0.0011 sec)
58
59. Without Histogram
EXPLAIN SELECT * FROM h1 WHERE x > 0G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: h1
partitions: NULL
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 9
filtered: 33.32999801635742 – The optimizer estimates about 1/3 of the data
Extra: Using where will go match the ‘X > 0’ condition
1 row in set, 1 warning (0.0007 sec) 59
The filtered column indicates an estimated percentage of table rows that will
be filtered by the table condition. The maximum value is 100, which means no
filtering of rows occurred.
Values decreasing from 100 indicate increasing amounts of filtering. rows shows
the estimated number of rows examined and rows × filtered shows the
number of rows that will be joined with the following table.
For example, if rows is 1000 and filtered is 50.00 (50%), the number of rows
to be joined with the following table is 1000 × 50% = 500.
60. Where Histograms Shine
ANALYZE TABLE h1 UPDATE HISTOGRAM ON x WITH 3 BUCKETSG
*************************** 1. row ***************************
Table: demox.h1
Op: histogram
Msg_type: status
Msg_text: Histogram statistics created for column 'x'.
1 row in set (0.0819 sec)
60
61. Where Histograms Shine
EXPLAIN SELECT * FROM h1 WHERE x > 0G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: h1
partitions: NULL
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 9
filtered: 100 – all rows!!!
Extra: Using where
1 row in set, 1 warning (0.0007 sec) 61
62. With EXPLAIN ANALYSE
EXPLAIN analyze SELECT * FROM h1 WHERE x > 0G
*************************** 1. row ***************************
EXPLAIN: -> Filter: (h1.x > 0) (cost=1.15 rows=9) (actual time=0.027..0.034 rows=9 loops=1)
-> Table scan on h1 (cost=1.15 rows=9) (actual time=0.025..0.030 rows=9 loops=1)
62
63. Performance is not just Indexes and Histograms
● There are many other ‘tweaks’ that can be made to speed things up
● Use explain to see what your query is doing?
○ File sorts, full table scans, using temporary tables, etc.
○ Does the join order look right
○ Buffers and caches big enough
○ Do you have enough memory
○ Disk and I/O speeds sufficient
63
64. Locking Options
MySQL added two locking options to MySQL 8.0:
● NOWAIT
○ A locking read that uses NOWAIT never waits to acquire a row lock. The query executes
immediately, failing with an error if a requested row is locked.
● SKIP LOCKED
○ A locking read that uses SKIP LOCKED never waits to acquire a row lock. The query executes
immediately, removing locked rows from the result set.
64
65. Locking Examples – Buying concert tickets
START TRANSACTION;
SELECT seat_no, row_no, cost
FROM seats s
JOIN seat_rows sr USING ( row_no )
WHERE seat_no IN ( 3,4 ) AND sr.row_no IN ( 5,6
)
AND booked = 'NO'
FOR UPDATE OF s SKIP LOCKED;
Let’s shop for tickets in rows 5 or 6 and seats 3 & 4 but we skip any locked
records!
65
66. LOCK NOWAIT
START TRANSACTION;
SELECT seat_no
FROM seats JOIN seat_rows USING ( row_no )
WHERE seat_no IN (3,4) AND seat_rows.row_no IN (12)
AND booked = 'NO'
FOR UPDATE OF seats SKIP LOCKED
FOR SHARE OF seat_rows NOWAIT;
Without NOWAIT, this query would have waited for innodb_lock_wait_timeout (default: 50)
seconds while attempting to acquire the shared lock on seat_rows. With NOWAIT an error is
immediately returned ERROR 3572 (HY000): Do not wait for lock. 66
68. Resource groups – setting and using
CREATE RESOURCE GROUP Batch
TYPE = USER VCPU = 2-3 -- assumes a system with at least 4 CPUs
THREAD_PRIORITY = 10;
SET RESOURCE GROUP Batch;
or
INSERT /*+ RESOURCE_GROUP(Batch) */ INTO t2 VALUES(2);
68
69. Optimizer Hints
SELECT /*+ JOIN_ORDER(t1, t2) */ ... FROM t1, t2;
Optimizer hints can be specified within individual statements. Because the
optimizer hints apply on a per-statement basis, they provide finer control over
statement execution plans than can be achieved using optimizer_switch.
For example, you can enable an optimization for one table in a statement and
disable the optimization for a different table.
69
70. Partitioning
● In MySQL 8.0, partitioning support is provided by the InnoDB and NDB
storage engines.
● Partitioning enables you to distribute portions of individual tables across a file
system according to rules which you can set largely as needed. In effect,
different portions of a table are stored as separate tables in different
locations.
70
71. The Query
EXPLAIN SELECT City.name,
Country.Name
FROM City
JOIN Country ON
(City.CountryCode = Country.Code)
WHERE Country.Code = 'GBR'G
71
72. The Query – What we want
EXPLAIN SELECT City.name,
Country.Name
FROM City
JOIN Country ON (City.CountryCode =
Country.Code)
WHERE Country.Code = 'GBR'G
72
73. The Query – Where we want it from
EXPLAIN SELECT City.name,
Country.Name
FROM City
JOIN Country ON
(City.CountryCode = Country.Code)
WHERE Country.Code = 'GBR'G
73
74. The Query – How the two tables relate
EXPLAIN SELECT City.name,
Country.Name
FROM City
JOIN Country ON
(City.CountryCode = Country.Code)
WHERE Country.Code = 'GBR'G
74
75. The Query – And any filters
EXPLAIN SELECT City.name,
Country.Name
FROM City
JOIN Country ON
(City.CountryCode = Country.Code)
WHERE Country.Code = 'GBR'G
75
77. The Actual Query Plan
select
`world`.`city`.`Name` AS `name`,
'United Kingdom' AS `Name`
from `world`.`city`
join `world`.`country` where
(`world`.`city`.`CountryCode` = 'GBR')
77
79. Optimizer substituted Country.name
explain format=tree SELECT City.name, Country.Name FROM City
JOIN Country ON (City.CountryCode = Country.Code) WHERE
Country.Code = 'GBR'G
*************************** 1. row ***************************
EXPLAIN: -> Index lookup on City using CountryCode
(CountryCode='GBR') (cost=26.85 rows=81)
So the optimizer ‘knows’ just to grab the ‘GBR’ records from the City table and does
not need to read the Country table at all.
79
80. Optimizer substituted Country.name
Explain ANALYZE SELECT City.name, Country.Name FROM City JOIN
Country ON (City.CountryCode = Country.Code) WHERE Country.Code
= 'GBR'G
*************************** 1. row ***************************
EXPLAIN: -> Index lookup on City using CountryCode
(CountryCode='GBR') (cost=26.85 rows=81)
(actual time=0.123..0.138 rows=81 loops=1)
1 row in set (0.0009 sec)
Explain ANALYZE runs the query and the estimate is pretty good!
80
81. 81
EXPLAIN SELECT City.name, Country.Name
FROM City
JOIN Country ON (City.CountryCode = Country.Code) WHERE Country.Code = 'GBR'G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: Country
partitions: NULL
type: const
possible_keys: PRIMARY
key: PRIMARY
key_len: 3
ref: const This is a CONSTANT
rows: 1
filtered: 100
Extra: NULL
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: City
partitions: NULL
type: ref
possible_keys: CountryCode
key: CountryCode
key_len: 3
ref: const
rows: 81 There are 81 records that match in the index
filtered: 100
Extra: NULL
2 rows in set, 1 warning (0.0013 sec)
83. Some General Rules
● Look at indexing/histogramming columns on right side of WHERE clause
● Maybe index SORT BY columns (test)
● JOIN on like type and size columns
○ i.e. No VARCHAR(32) to DECIMAL matches
● Can the data be found in an index?
83
84. Slightly More Complex
SELECT CONCAT(customer.last_name,', ', customer.first_name) AS customer,
address.phone,
film.title
FROM rental
INNER JOIN customer ON rental.customer_id = customer.customer_id
INNER JOIN address ON customer.address_id = address.address_id
INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id
INNER JOIN film ON inventory.film_id = film.film_id
WHERE rental.return_date IS NULL
AND rental_date + INTERVAL film.rental_duration DAY < CURRENT_DATE()
ORDER BY title
LIMIT 5;
84
89. Back to the old tabular EXPLAIN, cleaned up
| table | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
| rental | ALL | idx_fk_inventory_id,idx_fk_customer_id | NULL | NULL | NULL | 16008 | 10 | Using
where; Using temporary; Using filesort |
| customer | eq_ref | PRIMARY,idx_fk_address_id | PRIMARY | 2 | sakila.rental.customer_id | 1 | 100 | NULL
|
| address | eq_ref | PRIMARY | PRIMARY | 2 | sakila.customer.address_id | 1 | 100 | NULL
|
| inventory | eq_ref | PRIMARY,idx_fk_film_id | PRIMARY | 3 | sakila.rental.inventory_id | 1 | 100 | NULL
|
| film | eq_ref | PRIMARY | PRIMARY | 2 | sakila.inventory.film_id | 1 | 100 | Using where
|
89
90. First glance – what indexes are being used?
| table | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
| rental | ALL | idx_fk_inventory_id,idx_fk_customer_id | NULL | NULL | NULL | 16008 | 10 | Using
where; Using temporary; Using filesort |
| customer | eq_ref | PRIMARY,idx_fk_address_id | PRIMARY | 2 | sakila.rental.customer_id | 1 | 100 | NULL
|
| address | eq_ref | PRIMARY | PRIMARY | 2 | sakila.customer.address_id | 1 | 100 | NULL
|
| inventory | eq_ref | PRIMARY,idx_fk_film_id | PRIMARY | 3 | sakila.rental.inventory_id | 1 | 100 | NULL
|
| film | eq_ref | PRIMARY | PRIMARY | 2 | sakila.inventory.film_id | 1 | 100 | Using where
|
90
Anytime the type column shows all it means the entire file/table must be read, which is slow.
If it does have to read all the rows is it because there are no indexes available?
Or does it have to read all the table because is processing the entire table?
91. Slightly More Complex
SELECT CONCAT(customer.last_name,', ', customer.first_name) AS customer,
address.phone,
film.title
FROM rental
INNER JOIN customer ON rental.customer_id = customer.customer_id
INNER JOIN address ON customer.address_id = address.address_id
INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id
INNER JOIN film ON inventory.film_id = film.film_id
WHERE rental.return_date IS NULL
AND rental_date + INTERVAL film.rental_duration DAY < CURRENT_DATE()
ORDER BY title
LIMIT 5;
91
92. Quiz: Why so slow if it only has to return FIVE RECORDS?!?!?!?!
SELECT CONCAT(customer.last_name,', ', customer.first_name) AS customer,
address.phone,
film.title
FROM rental
INNER JOIN customer ON rental.customer_id = customer.customer_id
INNER JOIN address ON customer.address_id = address.address_id
INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id
INNER JOIN film ON inventory.film_id = film.film_id
WHERE rental.return_date IS NULL
AND rental_date + INTERVAL film.rental_duration DAY < CURRENT_DATE()
ORDER BY title
LIMIT 5;
92
93. Second glance – what EXTRAS are being used?
| table | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
+----+-------------+-----------+------------+--------+----------------------------------------+---------+---------+----------------------------
+-------+----------+----------------------------------------------+
| rental | ALL | idx_fk_inventory_id,idx_fk_customer_id | NULL | NULL | NULL | 16008 | 10 | Using
where; Using temporary; Using filesort |
| customer | eq_ref | PRIMARY,idx_fk_address_id | PRIMARY | 2 | sakila.rental.customer_id | 1 | 100 | NULL
|
| address | eq_ref | PRIMARY | PRIMARY | 2 | sakila.customer.address_id | 1 | 100 | NULL
|
| inventory | eq_ref | PRIMARY,idx_fk_film_id | PRIMARY | 3 | sakila.rental.inventory_id | 1 | 100 | NULL
|
| film | eq_ref | PRIMARY 100 | NULL |
| film | eq_ref | PRIMARY
93
The where; Using temporary; Using filesort informs that the output
has to be sorted (part of the sort clause) and that a temporary
table needed to be used.
94. MySQL 8.0 Temporary Table much faster
● Previously temporary tables were size limited and when they
reached that limit:
○ The processing was halted
○ The data was copied to InnoDB
○ The processing continued with the InnoDB copy of the data
○ And the above was slow
94
95. Is there something unindexed that need to be indexed?
● Or something we can use to build a histogram?
● Is there a better way to make the key?
95
96. SHOW INDEX FROM rental
● PRIMARY
● Rental_date – rental_date, inventory_id, customer_id
● Idx_fk_inventory_id – inventory_id, cutomer_id
● Idx_fk_staff_id
96
97. SHOW INDEX FROM film
● PRIMARY
● Idx_title
● Idx_fk_language_id
● Idx_fk_original_language_id
97
98. A Functional Index? Or Generated Column?
WHERE rental.return_date IS NULL
AND rental_date + INTERVAL film.rental_duration DAY < CURRENT_DATE() ORDER BY title LIMIT 5;
Could this part in red be reduced to a functional index/generated column?
AND return_date < CURRENT_DATE()
film.rental_duration + rental_date
Would want to store this in the record with the rental data?
98
99. Yes, let us add that new column
● ALTER TABLE operations can be expensive
● How do we seed data
● Do we use a GENERATED COLUMN? Can we?
● Do we add a stub table?
○ Extra index/table dives
○ How much code do we have to change?
○ Other considerations
99
100. Where Else To Look for Information
● MySQL Manual
● Forums.MySQL.com
● MySQLcommunity.slack.com
100
101. New Book
● YOU NEED THESE BOOKS!!
● Author’s others work are also
outstanding and well written
● Amazing detail!!
101
102. Great Book
● Getting very dated
● Make sure you get the 3rd edition
● Can be found in used book stores
102
103. My Book
● A guide to using JSON and MySQL
○ Programming Examples
○ Best practices
○ Twice the length of the original
○ NoSQL Document Store how-to
103
104. “We have saved around 40% of our
costs and are able to reinvest that
back into the business. And we are
scaling across EMEA, and that’s
basically all because of Oracle.”
—Asser Smidt
CEO and Cofounder, BotSupply
Startups get cloud credits and a 70%
discount for 2 years, global exposure via
marketing, events, digital promotion, and
media, plus access to mentorship, capital
and Oracle’s 430,000+ customers
Customers meet vetted startups in
transformative spaces that help them stay
ahead of their competition
Oracle stays at the competitive edge
of innovation with solutions that complement
its technology stack
Oracle for Startups - enroll at oracle.com/startup
A Virtuous Cycle of Innovation, Everybody Wins.
105. Thank you
● David.Stokes @Oracle.com
● @Stoker
● PHP Related blog https://elephantdolphin.blogspot.com/
● MySQL Latest Blogs https://planet.mysql.com/
● Where to ask questions https://forums.mysql.com/
● Slack https://mysqlcommunity.slack.com
slides -> slideshare.net/davestokes
105