The MySQL Replication was my first project as a Database
Administrator (DBA) and I have been working with Replication
technologies for last few years and I am indebted to contribute
my little part for development of this technology. MySQL supports
different replication topologies, having better understanding of
basic concepts will help you in building and managing various and
complex topologies. I am writing here, some of the key points to
taken care when you are building MySQL replication. I consider
this post as a starting point for building a high performance and
consistent MySQL servers. Let me start with below key
points Hardware. MySQL Server Version MySQL Server Configuration
Primary Key Storage Engine I will update this post with relevant
points, whenever I get time. I am trying to provide generic
concepts and it will be applicable to all version of MySQL,
however, some of the concepts are new and applicable to latest
versions …
The release of MySQL 8.0 has brought a lot of bold implementations that touched on things that have been avoided before, such as added support for common table expressions and window functions. Another example is the change in how AUTO_INCREMENT (autoinc) sequences are persisted, and thus replicated.
This new implementation carries the fix for bug #73563 (Replace result in auto_increment value less or equal than max value in row-based), which we’ve only found about recently. The surprising part is that the use case we were analyzing is a somewhat common one; this must be affecting a good number of people out there.
Understanding the bug
The business logic of the use case is such the UNIQUE column found in a table whose id is managed by an AUTO_INCREMENT sequence needs to be updated, and this is done with a …
[Read more]MySQL Adventures: How max_prepared_stmt_count can bring down production
We recently moved an On-Prem environment to GCP for better scalability and availability. The customer’s main database is MySQL. Due to the nature of customer’s business, it’s a highly transactional workload (one of the hot startups in APAC). To deal with the scale and meet availability requirements, we have deployed MySQL behind ProxySQL — which takes care of routing some of the resource intensive SELECTs to chosen replicas. The setup consists of:
- One Master
- Two slaves
- One Archive database server
Post migration to GCP, everything was nice and calm for a couple of weeks, until MySQL decided to start misbehaving and leading to an outage. We were able to quickly resolve and bring the system back online and what follows are lessons from this experience.
The configuration of the …
[Read more]Some time ago, a customer had a performance issue with an internal process. He was comparing, finding, and reporting the rows that were different between two tables. This is simple if you use a LEFT JOIN and an
IS NULL
comparison over the second table in the WHERE clause, but what if the column could be null? That is why he used UNION, GROUP BY and a HAVING clauses, which resulted in poor performance.
The challenge was to be able to compare each row using a LEFT JOIN over NULL values.
The challenge in more detail
I’m not going to use the customer’s real table. Instead, I will be comparing two sysbench tables with the same structure:
CREATE TABLE `sbtest1` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `k` int(10) unsigned DEFAULT NULL, `c` char(120) DEFAULT NULL, `pad` char(60) DEFAULT NULL, PRIMARY …[Read more]
To resolve a critical regression, Percona announces the release of Percona XtraDB Cluster 5.7.23-31.31.2 on October 2, 2018 Binaries are available from the downloads section or from our software repositories.
This release resolves a critical regression in Galera’s wsrep library and supersedes 5.7.23-31.31
Percona XtraDB Cluster 5.7.23-31.31.2 is now the current release, based on the following:
- Percona Server 5.7.23-23
- Galera …
Following my post from a year ago https://www.percona.com/blog/2017/07/06/clickhouse-one-year/,
I wanted to review what happened in ClickHouse during this
year.
There is indeed some interesting news to share.
1. ClickHouse in DB-Engines Ranking. It did not quite get into the
top 100, but the gain from position 174 to 106 is still
impressive. Its DB-Engines Ranking score tripled from 0.54 last
September to 1.57 this September
And indeed, in my conversation with customers and partners, the narrative has changed from: “ClickHouse, what is …
[Read more]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]MySQL supports replicating to a slave that is one release higher. This allows us to easily upgrade our MySQL setup to a new version, by promoting the slave and pointing the application to it. However, though unsupported, there are times when the MySQL version of slave deployed is one release lower. In this scenario, if your application has been performing much better on an older version of MySQL, you would like to have a convenient option to downgrade. You can simply promote the slave to get the old performance back.
The MySQL manual says that ROW based
replication can be used to replicate to a lower version, provided
that no DDLs replicated are incompatible with the slave. One such
incompatible command is ALTER USER which is a new
feature in MySQL 5.7 and not available on 5.6. :
ALTER USER …[Read more]
This release has been superseded by 5.7.23-31.31.2 after a critical regression was found. Please update to the latest release.
Percona is glad to announce the release of Percona XtraDB Cluster 5.7.23-31.31 on September 26, 2018. Binaries are available from the downloads section or from our software repositories.
Percona XtraDB Cluster 5.7.23-31.31 is now the current release, based on the following:
[Read more]MySQL has locking capabilities, for example table and row level locking, and such locks are needed to control data integrity in multi-user concurrency. Deadlocks—where two or more transactions are waiting for one another to give up locks before the transactions can proceed successfully—are an unwanted situation. It is a classic problem for all databases including MySQL/PostgreSQL/Oracle etc. By default, MySQL detects the deadlock condition and to break the deadlock it rolls back one of the transactions.
For a deadlock example, see InnoDB deadlocks
Some misconceptions
There are some misconceptions about deadlocks:
a) Transaction isolation levels are responsible for deadlocks. The possibility of deadlocks is not affected by isolation level. Isolation level changes the behavior of read …
[Read more]