Showing entries 1 to 10 of 11
1 Older Entries »
Displaying posts with tag: Databases & SQL (reset)
Common pitfalls when migrating MySQL to Aurora using AWS DMS

We recently migrated some of EverSQL's workload from AWS RDS MySQL to Aurora MySQL. In this post I'll share several options I explored, and the issues I ran into when using each of them, and specifically AWS DMS, so hopefully you could avoid similar issues when going through the migration process.

Potential solutions for migrating RDS MySQL to Aurora MySQL

Naturally, I first started with AWS's documentation, which states you can migrate RDS MySQL to Aurora MySQL by creating an Aurora read replicate and promoting it after replication is done. Unfortunately, that solution wasn't viable in our case, as the RDS instance was already upgraded to MySQL 8.0.28, while Aurora MySQL only supports …

[Read more]
[Solved] Aurora MySQL, Innodb and Indexes: Creating index required more than ‘innodb_online_alter_log_max_size’ bytes of modification log. Please try again.

The challenge If you have a large MySQL table and you're trying to add a new column and index it, you may have ran into this error:

Creating index 'Name' required more than 'innodb_online_alter_log_max_size' bytes 
of modification log. Please try again.

So how can you address it?

The solution

By default, recent MySQL versions will execute the ALTER statement with the INPLACE flag (unless it's eligible for INSTANT alter, though that's not always the case). this means that the database is using a temporary log (size of innodb_online_alter_log_max_size) which is by default 128MB in most recent versions, to keep track of DML changes happening during the ALTER command. So if the database is executing an UPDATE/INSERT/DELETE during the ALTER, it will keep track of those changes in the temp file, and then after the ALTER is done, it will apply those changes to the table as well.
So you have several options we can …

[Read more]
Choosing the best indexes for MySQL query optimization

Many of our users, developers and database administrators, keep asking our team about EverSQL's indexing recommendations algorithm. So, we decided to write about it.

The first option is to use EverSQL to automatically find indexes that are best for your database.

The second option is to read our detailed tutorial below and learn more about indexing best practices.

This tutorial won't detail all the internals of the algorithm, but rather try to lay out the basic and important aspects of indexing, in simple terms.
Also, and most importantly, we'll present practical examples for properly indexing your tables and queries by relying on a set of …

[Read more]
Why We’re Debugging MySQL Server and How?

Why Debug MySQL?

Building MySQL from its source code sounds like something you won't normally do, though it can be useful for several scenarios:

  1. When you want to contribute to MySQL with a new feature or a bug fix.
  2. When you want to explore how MySQL or the underline engines behave, beyond what's documented.
  3. When you're considering to fork MySQL for your work and customize it in your own repository.
  4. When you want to create a custom MySQL build with custom build parameters or compiler optimizations.

For us at EverSQL, it's reason #2.

To improve our query optimization algorithms, we're constantly exploring the database's source code, to learn how the database operates, beyond what's actually documented, and how can our product complement the database's core functionality.

In this tutorial, you'll learn …

[Read more]
MySQL 8.x Adoption Rate – Survey Results

An exciting feature-full new version of MySQL (v8.x) was released on April 2018. Along with those exciting features, there were many changes and enhancements done in MySQL's internal optimizer. Naturally, we at EverSQL keep an eye on major changes in MySQL's optimizer, to make sure we are familiar with them and co-exist with them.

So now that 2019 started, I thought it's a good point in time to look back and see how well this new version is adopted by the community. To do that, we surveyed our users for 3 months, from October to December 2018, asking which MySQL database version are they using for their main product's environment. Please note that these results are in no way scientifically-true, nor statistically-true. It's just the data we received and thought it can be interesting to share with the community.

During these 3 months, we received 2000 survey replies from professionals working in companies with more than 5 people. So …

[Read more]
MySQL Explain Example – Explaining MySQL EXPLAIN using StackOverflow data

I personally believe that the best way to deliver a complicated message to an audience, is by using a simple example. So in this post, I chose to demonstrate how to obtain insights from MySQL's EXPLAIN output, by using a simple SQL query which fetches data from StackOverflow's publicly available dataset.

The EXPLAIN command provides information about how MySQL executes queries. EXPLAIN can work with SELECT, DELETE, INSERT, REPLACE, and UPDATE statements.

We'll first analyze the original query, then attempt to optimize the query and look into the optimized query's execution plan to see what changed and why.

This is the first article in a series of posts. Each post will walk you through a more advanced SQL query than the previous post, while demonstrating more insights which can be obtained from MySQL's execution plans.

The query and database …

[Read more]
SQL Order of Operations – In Which Order MySQL Executes Queries?

Knowing the bits and bytes of an SQL query's order of operations can be very valuable, as it can ease the process of writing new queries, while also being very beneficial when trying to optimize an SQL query.

If you're looking for the short version, this is the logical order of operations, also known as the order of execution, for an SQL query:

  1. FROM, including JOINs
  2. WHERE
  3. GROUP BY
  4. HAVING
  5. WINDOW functions
  6. SELECT
  7. DISTINCT
  8. UNION
  9. ORDER BY
  10. LIMIT and OFFSET

But the reality isn't that easy nor straight forward. As we said, the SQL standard defines the order of execution for the different SQL query clauses. Said that, modern databases are already challanaging that default order by applying some optimization tricks which might change the actual order of execution, though they must end up returning …

[Read more]
MariaDB vs MySQL – Comparing MySQL 8.0 with MariaDB 10.3

Introduction

The goal of this article is to evaluate and highlight the main similarities and differences between the MySQL Server Database and the MariaDB Server Database. We’ll look into performance aspects, security, main features, and list all aspects which need to be considered before choosing the right database for your requirements.

Who is using MySQL and MariaDB?

Both MySQL and MariaDB publish a respectful list of customers who are using their database as their core data infrastructure.

For MySQL, we can see names such as Facebook, Github, YouTube, Twitter, PayPal, Nokia, Spotify, Netflix and more.

For MariaDB, we can see names such as Redhat, DBS, Suse, Ubuntu, 1&1, Ingenico and more.

Comparing features - MySQL vs MariaDB

Many new and exciting features like Windows Functions, Roles or Common Table Expressions (CTE) are probably worth mentioning, but won’t be mentioned …

[Read more]
How to Transfer a MySQL Database Between Two Servers?

Migrating a MySQL database usually requires only few simple steps, but can take quite some time, depending on the amount of data you would like to migrate.

The following steps will guide through how to export the MySQL database from the old server, secure it, copy it to the new server, import it successfully and make sure the data is there.

Exporting MySQL database to a dump file

Oracle provides a utility named mysqldump which allows to easily export the database structure and data to an SQL dump file. Use the following command:

mysqldump -u root -p --opt [database name] > [database name].sql

Few notes:

[Read more]
How to calculate median value in MySQL using a simple SQL query

What is a median value?

The median of an array of numbers is the value of the middle item in the array, assuming the array is sorted. If the array has an even number of items, the median represents the average of the two middle values in the array.

This value is very popular one tries to understand “in which half my value is?”. For example, I got a D (or 80) in my last test at school, am I in the top 50% of my class students or not?

As a practical example, let’s look into the process of retrieving the median value from the following array of school test grades: [55, 80, 95, 100, 99, 70, 60].

  1. First, we’ll sort the array: [55, 80, 95, 100, 99, 70, 60]  ===> [55, 60, 70, 80, 95, 99, 100].
  2. The array contains 7 items, which isn’t an even number, so therefore the median is the (7 / 2 + 1) item, which is the 4th item => 80.

Calculating the median value of …

[Read more]
Showing entries 1 to 10 of 11
1 Older Entries »