This blog was originally published in January 2021 and updated in November of 2023.As businesses and applications increasingly rely on MySQL databases to manage their critical data, ensuring data reliability and availability becomes paramount. In this age of digital information, robust backup and recovery strategies are the pillars on which the stability of applications stands. […]
This blog post discusses using the [crayon-659c2fe27b13a472295750-i/] command with the safety option [crayon-659c2fe27b141470126814-i/] when you do not have enough disk space to store two datasets.In my previous blog post on the [crayon-659c2fe27b142478330007-i/] command, The MySQL Clone Plugin Is Not Your Backup, I mentioned that using the option [crayon-659c2fe27b143176725038-i/] helps to avoid situations where you need to re-initialize […]
Visual Studio Code (VS) supports memory dump debugging via C/C++ extension: https://code.visualstudio.com/docs/cpp/cpp-debug#_memory-dump-debugging. When MySQL generates a core file, the VS code simplifies the process of debugging. This blog will discuss how to debug the core file in VS code.Installing c/c++ extensionWe need to install the c/c++ extension. Here are the instructions for doing so. In […]
A common practice among DBAs and developers is to copy table data and .frm files from the data dictionary. They often set up batch jobs to automate the recovery of these tables. This capability is also utilized in disaster recovery scenarios, where individuals well-versed in .frm files can reconstruct their metadata as needed.
In MySQL 8.0, the information is presented within serialized objects within the dictionary. In the case of InnoDB tablespaces, this information is incorporated into the tablespace itself, creating a fusion of metadata and data primarily to enhance performance. MySQL writes a .sdi file to accommodate the serialized dictionary information for storage engines that lack support for this functionality.
Purpose of .sdi files
Serialized dictionary information (SDI) files store serialized metadata about various database objects, such as tables, indexes, and other schema-related details. This serialized data …
[Read more]This blog post discusses roles in MySQL 8.0, which are named collections of privileges. Like user accounts, roles can have privileges granted and revoked as required.
Typically, we have multiple users with the same set of privileges. Previously, the only way to grant and revoke privileges to multiple users was to change the privileges of each user individually, which was time-consuming. To make it easier, MySQL provided a new object called role. A role is a named collection of privileges.
Here are the primary SQL commands that we will be discussing in relation to managing MySQL roles:
CREATE ROLE and DROP ROLE create and remove roles. GRANT and REVOKE assign privileges to revoke privileges from user accounts and roles. SHOW GRANTS displays privilege and role assignments for user accounts and roles. SET DEFAULT ROLE specifies which account roles are active by default. SET ROLE changes the active roles within the current session. The …[Read more]
Performing an operation is always challenging when dealing with K8s.
When on-prem or DBaaS like RDS or Cloud SQL, it is relatively straightforward to apply a change. You can perform a DIRECT ALTER, use a tool such as pt-osc, or even, for certain cases where async replication is in use, perform changes on replicas and failover.
In this blog post, I’ll provide some thoughts on how schema changes can be performed when running MySQL on Kubernetes
I won’t focus on DIRECT ALTERs as it is pretty straightforward to apply them. You can just connect to the MySQL service POD and perform the ALTER.
But how can we apply changes in more complex scenarios where we may want to benefit from pt-osc, gain better control over the operation, or take advantage of the K8s features?
One convenient way that I’ve found …
[Read more]Transparent Huge Pages (THP) is a memory management feature in Linux operating systems that aims to enhance system performance. While THP can be beneficial for many applications, enabling it on a database server could have unintended consequences. In this post, we will explore THP, its impact on database servers, and how to disable it for optimal performance and stability.
What are Transparent Huge Pages?
In order to understand THP, we should first start with a brief description of Linux HugePages. The concept of HugePages in Linux has existed for many years, first introduced in 2007. By default, the majority of widely used Linux distributions employ a virtual memory page size of 4KB. However, the inclusion of the HugePages feature allows the Linux kernel to efficiently handle substantial memory pages alongside the standard 4KB size.
In order for an application to utilize HugePages, however, it must explicitly include an …
[Read more]This post was originally published in 2011 and was updated in October 2023.
I see this message on our forums, and I think it’s a great question: “Which version of Percona Server is currently recommended?” It’s really the same question as “Which version of MySQL is currently recommended?” In this blog, we cover everything you need to know about how to choose the right version of MySQL for your needs, as well as key information on the latest versions, 5.7 and 8.0.
Understanding MySQL Versions
MySQL versions play a pivotal role in database management, as each MySQL version represents a distinct release, encompassing enhancements, bug fixes, and new features that affect the performance, security, and functionality of the database and applications. Staying informed about MySQL version updates is vital for anyone tasked with managing databases, as it directly impacts the efficiency and reliability of data …
[Read more]As a DBA, one of the very frequent tasks is to stop/start MySQL service for batching or some other activities. Before stopping MySQL, we may need to check if there are any active connections; if there are, we may need to kill all those. Generally, we use pt-kill to kill the application connections or prepare kill statements using the select queries.
Example commands:
pt-kill --host=192.168.11.11 --user=percona -p --sentinel /tmp/pt-kill.sentinel2 --pid /tmp/pt-kill.pid --victims all --match-command 'Query' --ignore-user 'pmm|rdsadmin|system_user|percona' --busy-time 10 --verbose --print --kill select concat('kill ',id,';') from information_schema.processlist where user='app_user';
MySQL has a variable called offline_mode to set the server into maintenance mode. When you set this, it immediately disconnects all the client connections that don’t …
[Read more]Whenever you install your favorite MySQL server on a freshly created Ubuntu instance, you start by updating the configuration for MySQL, such as configuring buffer pool, changing the default datadir director, and disabling one of the most outstanding features – query cache. It’s a nice thing to do, but first things first. Let’s review the best practices we usually follow in Managed Services before using your MySQL server in production and stage env, even for home play purposes.
Memory
Our usual recommendation is to use specific memory parameters, which we suggest to ensure optimal performance.
- To prevent out-of-memory (OOM) episodes, the OOM Score has to be set to -800.
- vm.swappiness = 1
- Disable Transparent Huge Pages
- Install and enable jemalloc. Let’s briefly go through each setting to understand why adjustments are needed. Afterward, we will see how to configure these …