Tag: SQL
-
Generating UUIDs with MySQL
Universally unique identifiers (UUID) are one of my favorite things. They are easy to generate, without collision, and they make it easy to expose an identifier to end users without it being so obviously guessable, like an automatically incrementing integer value. While they are fantastic, the ability to generate one…
-
Add column after another column in MySQL
By default, new columns are added to the end of a table in MySQL. This works well most of the time, but sometimes when you’re retrofitting a column into a table, you may want it to be adjacent columns closer to the start of the table. The ALTER statement makes…
-
How to kill a query on Amazon Relational Database Service (RDS)
Coming from MySQL / MariaDB, I was surprised that I couldn’t kill a query on an Amazon’s Relational Database Service or Amazon Aurora with the kill command. Fortunately, the functionality isn’t omitted, it’ just buried under some AWS RDS specific command. Before we go over that, let’s go over how…
-
Transactions with PHP Data Objects (PDO)
PHP Data Objects (PDO) is arguably the best database abstraction layer available in PHP. It provides a consistent interface across multiple datasources (MySQL, PostgreSQL, et cetera) and helps boost your site’s security by way of prepared statements. It even supports transactions which we’ll be taking a look at here. Database…
-
How to Use Prepared Statements in PHP
Now that we know how to create a connection to our database using PHP Data Objects, let’s talk a bit about prepared statements. Now I’d like to think that we’ve all made this mistake before, taken user input and used it in an SQL query something like this: $db->execute(‘SELECT *…
-
MySQL and Redis Command Equivalents
Score another one for HitTail as this particular topic was their suggestion. MySQL (PostgreSQL, SQL Server, SQLite or any other RDBMS I didn’t list) and Redis are completely different beasts in regard to syntax and especially schema design (or lack there of). The following are just some common SQL statements…
-
SQLite as a PHP Session Handler
Now that I’ve discussed the in-memory data stores (NoSQL if you will) let’s switch gears to a more traditional RDBMS. SQLite by definition is a software library that implement a self-contained server-less, zero-configuration, transactional SQL database engine. It’s more important claim to fame is that it is the most widely…
-
Drain your InnoDB Buffer Pool by moving large fields out of MySQL
This was supposed to be a “SceneKids.com the first year” post, but nothing has really changed too much since the 8 month post with the exception of expanding out with additional websites on the same platform. Instead, I’m going to discuss a dilemma I ran into with MySQL’s InnoDB data…
-
Issue with SQLyog Job Agent on Ubuntu
No error message, it just says that the sync had started. What sucks about this issue, is that I ran into it with a previous version of SQLyog Job Agent (sja) but was able to troubleshoot it faster because the program would dump an error message. I have been messing…