CodeIgniter 4 Query Builder class has an update() function used to process UPDATE Data Manipulation Language (DML) commands. Using update() as a standalone function call is perfectly valid. However, there is also a set() function used for setting column values as you would with the SET keyword in an SQL UPDATE statement. Used in conjunction with the Query Builder where() function, you can easily UPDATE column values for an individual row or multiple rows. Continue reading for more information…
[Read more]The latest from the MySQL community
Ideas, releases, practical guides, and perspectives from the people building with MySQL.
To copy the data of the particular column of the table to another table/server, We have an option to export the data as CSV and import the data back to a different table. But when the table size is large and we need to copy the data only for the required data to the target table will cause the load in the server since the table scanning is huge.
To overcome this, we have the pt-archiver copy the data from the source table to the destination as a whole or only for required columns. And also we can do this in a controlled manner as well. So there will be no performance impact even on the production time.
Source table structure :
mysql> show create table source\G
*************************** 1. row ***************************
Table: source
Create Table: CREATE TABLE `source` (
`id` int unsigned NOT NULL …[Read more]
Percona XtraDB Cluster 8.0.25 has introduced a new option to perform online schema modifications: NBO (Non Blocking Operation).
When using PXC the cluster relies on wsrep_OSU_method parameter to define the Online Schema Upgrade (OSU) method the node uses to replicate DDL statements.
Until now we normally have 3 options:
- Use Total Isolation Order (TOI, the default)
- Use Rolling Schema Upgrade (RSU)
- Use Percona’s online schema change tool (TOI + PTOSC)
Each method has some positive and negative aspects. TOI will lock the whole cluster from being able to accept data modifications for the entire time it takes to perform the DDL operation. RSU …
[Read more]Percona XtraDB Cluster 8.0.25 has introduced a new option to perform online schema modifications: NBO (Non Blocking Operation).
When using PXC the cluster relies on wsrep_OSU_method parameter to define the Online Schema Upgrade (OSU) method the node uses to replicate DDL statements.
Until now we normally have 3 options:
- Use Total Isolation Order (TOI, the default)
- Use Rolling Schema Upgrade (RSU)
- Use Percona’s online schema change tool (TOI + PTOSC)
Each method has some positive and negative aspects. TOI will lock the whole cluster from being able to accept data modifications for the entire time it takes to perform the DDL operation. RSU …
[Read more]Percona XtraDB Cluster 8.0.25 (PXC) has introduced a new option to perform online schema modifications: NBO (Non-Blocking Operation).
When using PXC, the cluster relies on the wsrep_OSU_method parameter to define the Online Schema Upgrade (OSU) method the node uses to replicate DDL statements.
Until now, we normally have three options:
- Use Total Isolation Order (TOI, the default)
- Use Rolling Schema Upgrade (RSU)
- Use Percona’s online schema change tool (TOI + PTOSC)
Each method has some positive and negative aspects. TOI will lock the whole …
[Read more]Working on a real case scenario in a five node Percona XtraDB Cluster (PXC), we were forced to use wsrep_sync_wait = 1, because the app does reads-after-write and we send reads to all the nodes. We had the idea to leave some nodes in DESYNC mode to reduce the flow control messages during peak load and expected to have a steadier write throughput keeping the read consistency.
We decided to test Perconas’s new PXC Scheduler Handler which is an application that manages integration between ProxySQL and Galera/PXC (the scope is to maintain the ProxySQL mysql_server table, if a negative scenario occurs, like: failures, service degradation, and maintenance). However, we realized that when a node is in DESYNC mode, it is kicked out of the read hostgroup. That is …
[Read more]MySQL window functions can be used to calculate daily averages or moving averages for a 24h time window relatively easily. In an earlier article
basic window functions were already discussed. In this article, we want to see how we can get daily buckets and moving averages.
A sample program is available, as usual, on GitHub
.
We will be working with a data table named data,
with three columns: a sensor id, a measurement
datetime d and a metric value m that
was sampled at that time. The table definition looks like this: …
While exporting the table with MySQL native utility, we don’t have any control on the process, and also there will be no progress update as well on the process completion. So when exporting the larger table will consume high resource utilization and also the disk space usage will also be high.
MySQL shell utility will make the process easier. It will export the table and we can import the data back with a parallel thread and also will provide the current progress status on export/import progress.
util.exportTable() utility was introduced in Shell – 8.0.22 version, will export the data in a controlled manner. We can store the data in either local or Cloud Infrastructure Object Storage bucket as well.
We will see about the compression ratio along with the time taken for native MySQL vs Shell utility
Feature :
- Compression
- Progress status
- Supported output …
We all tried various alternative methods for modifying the table structure, but pt-online-schema-change (pt-osc) is the most convenient and preferred method for performing the alter online. It has more granular control too. But it may lead to data loss if proper precautionary steps are not taken care of.
In this blog, we are going to modify a column to a unique key using pt-osc, below I have shared the table structure.
mysql> show create table test\G * 1. row * Table: test Create Table: CREATE TABLEtest(Personidint(11) NOT NULL AUTO_INCREMENT,LastNamevarchar(255) NOT NULL,FirstNamevarchar(255) DEFAULT NULL,Ageint(11) DEFAULT NULL, PRIMARY KEY (Personid) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 1 row in set (0.00 sec)
I have inserted the data of 1000 rows using …
[Read more]Generally, most all web applications are going to follow the elements of CRUD: Create, Read, Update, and Delete. CodeIgniter 4 is a powerful PHP web development framework that provides a rapid development environment. The CodeIgniter 4 Models come enriched with built-in CRUD functionality, which is covered in this compilation of Medium posts…
Image by Dariusz Sankowski from Pixabay
Disclaimer: I originally published these articles first over on …
[Read more]