Showing entries 1183 to 1192 of 44037
« 10 Newer Entries | 10 Older Entries »
COUNT(*) vs COUNT(col) in MySQL

Looking at how people are using COUNT(*) and COUNT(col), it looks like most of them think they are synonyms and just use what they happen to like, while there is a substantial difference in performance and even query results. Also, we find a difference in execution on InnoDB and MyISAM engines.

NOTE: All tests were applied for MySQL version 8.0.30, and in the background, I ran every query three to five times to make sure that all of them were fully cached in the buffer pool (for InnoDB) or by the filesystem (for MyISAM).

Count function for Innodb engine:

Let’s have look at the following series of examples for InnoDB engine:

CREATE TABLE count_innodb (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  val_with_nulls int(11) default NULL,
  val_no_null int(10) unsigned NOT NULL,
  PRIMARY KEY idx (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

(mysql) > select count(*) from count_innodb; …
[Read more]
OpenLampTech issue #60 – Substack Repost

Thank you so much for reading OpenLampTech and making it the success it is today. Wow! 600 developers reading each week! I am humbled to say the very least.

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

In OpenLampTech issue #60, we are looking at some fantastic articles covering:

  • Laravel Eloquent and Query Builder tips
  • Drupal’s updated CKEditor 5
  • How Symfony powers Drupal
  • Best SQL Editors
  • WooCommerce Payment Gateways
  • And much more

Want to help OpenLampTech be a success …

[Read more]
How to import data from Microsoft SQL Server to MySQL HeatWave Database Service

If you have data stored in a Microsoft SQL Server database and you want to import it into MySQL HeatWave Database Service in OCI, you can use the procedure described in this article.

How to speed up a Mysql replica?

There are several ways you can try to speed up a MySQL replica. Here are some ideas:

MySQL InnoDB Redo Log Archiving

What is MySQL InnoDB Redo Log Archiving ? How does it work ? Discover this important MySQL InnoDB feature reading this blog post.

Live Migration from Azure Database for MySQL to MySQL HeatWave Database Service on OCI

Live Migration from Azure Database for MySQL to MySQL HeatWave Database Service on Oracle Cloud (OCI)

Using MySQL Shell to generate table’s create statement from CSV file

MySQL Shell is a command-line interface for interacting with MySQL servers. It allows you to run SQL queries and perform various tasks related to MySQL databases. In this post we will see how we can use MySQL Shell and a plugin to generate table's create statement from a CSV file containing records.

Quick Data Archival in MySQL Using Partitions

Space constraint has been an endless and painstaking process for many of us, especially in systems that have a high number of transactions and data growth exceeding hundreds of GBs in a matter of days. In this blog, I will share a solution to remove this space and remove rows from tables in a few seconds regardless of the size of a table without causing any additional load on the database using table partitions.

The first approach that comes to anyone’s mind for deleting the row is using a DELETE query in SQL. Suppose, one wants to delete rows from a table that are older than one year—the query for such operations would be like this:

DELETE FROM salaries WHERE from_date <DATE_SUB(NOW(),INTERVAL 1 YEAR);

The above query is pretty straightforward but there are a few caveats:

  • Server business will grow exponentially and could impact the usual traffic on the server.
  • To speed up the above query …
[Read more]
Tale of a MySQL 8 Upgrade and Implications on Backup

Recently, we performed a database engine major version upgrade in one of our customers’ environments from MySQL 5.7.26 to 8.0.27. After this version upgrade, we experienced issues with backups and replication for one of the nodes.

In this article, I will explain these issues in detail and recommend a way to take backups from a replication environment.

To begin with, we upgraded all the database nodes from 5.7.26 to 8.0.27 and as a recommended way we have a backup set-up from one of the replica nodes. Physical backups are being taken using Percona XtraBackup (PXB) so it does not lock the database during the backup.

With MySQL 5.7, a backup was taken using PXB 2.4. Due to the new data dictionaries, redo log and undo log in MySQL 8.0, we also upgraded PXB to 8.0.27 to avoid …

[Read more]
How to import data from Amazon Redshift to MySQL HeatWave Database Service

Importing CSV files into a MySQL HeatWave Database Service instance is very easy and efficient thanks to MySQL Shell. It can be used to import data from RedShift as we describe in this post.

Showing entries 1183 to 1192 of 44037
« 10 Newer Entries | 10 Older Entries »