MySQL BENCHMARK() Explained

In MySQL, BENCHMARK() is a built-in function that executes an expression repeatedly for a specified number of times.

It can be used to time how quickly MySQL processes the expression. Specifically, the function is intended for measuring the runtime performance of scalar expressions.

The result is always 0, or NULL for inappropriate arguments. The function is intended to be used within the mysql command line tool, which reports query execution times.

Continue reading

3 PostgreSQL AUTO_INCREMENT Equivalents

In MySQL and MariaDB we can use the AUTO_INCREMENT keyword to create an automatically incrementing column in a table. In SQLite, we’d use the AUTOINCREMENT keyword. And in SQL Server we can use the IDENTITY property. Some of those DBMSs also allow us to create sequence objects, which provide us with more options for creating an auto-increment type column.

When it comes to PostgreSQL, there are a few ways to create an auto-incrementing column. Below are three options for creating an AUTO_INCREMENT style column in Postgres.

Continue reading