// 25.Nov.2009

Top 20+ MySQL Best Practices

Ah now this is pure gold, 21 things to keep in mind when coding for MySQL. Most of these I knew but it was good to be reminded. Some of them are entirely new to me though:

  • Use ENUM over VARCHAR: ENUM type columns are very fast and compact. Internally they are stored like TINYINT, yet they can contain and display string values.
  • Store IP Addresses as UNSIGNED INT: Many programmers will create a VARCHAR(15) field without realizing they can actually store IP addresses as integer values. With an INT you go down to only 4 bytes of space, and have a fixed size field instead.
  • Do Not ORDER BY RAND(): This is one of those tricks that sound cool at first, and many rookie programmers fall for this trap. You may not realize what kind of terrible bottleneck you can create once you start using this in your queries.

Priceless information. I’ll be referring back to this list over and over again.


// 19.Nov.2009

MySQL Tuning Primer Script

The MySQL Tuning Primer script takes information from “SHOW STATUS LIKE…” and “SHOW VARIABLES LIKE…” then attempts to produce sane recommendations for tuning server variables. It is compatible with all versions of MySQL 3.23 - 5.1.


// 19.Nov.2009

Fixing Poor MySQL Default Configuration Values

Database guru Jeremy Zawodny helps us out with a handful of MySQL tweaks for high-volume databases that could boost their performance.


// 25.May.2009

How to Set Up a Killer Local WordPress Development Environment


// 31.Jan.2009

LAMP Tuning

If you’re reaching the limits of your Apache server because you’re serving a lot of dynamic content, you can either spend thousands on new equipment or reduce bloat to increase your server capacity from 2 to 10 times. This article concentrates on important and weakly documented ways of increasing capacity without the need for additional hardware.


// 27.Dec.2008

5 Helpful Tips for Creating Secure PHP Applications

PHP is one of the most popular programming languages for the web. Sometimes a feature-friendly language can help the programmer too much, and security holes can creep in, creating roadblocks in the development path. Here are 5 tips to help you avoid some common PHP security pitfalls and development glitches.


// 17.Nov.2008

Programmer’s Cheat Sheets

As a programmer/web-designer I dip into a diverse range of programming languages and frameworks. I often find that I get locked into a specific coding grammar/syntax and that it is then difficult to switch to a new one. This is when I find the following cheat sheets invaluable (and indeed comforting).


// 13.Jul.2008

Accelerating My WordPress Installation

Lamborghini

I’m currently engaged in the process of trying boost the performance of this website as some of the page weights and loading times are horrific (God, how I miss mod_perl). These are the steps I’ve taken so far:

  • Turned on mod_deflate and am now serving my XHTML, CSS and JavaScript as GZIP’d files.
  • Uninstalled various non-essential WordPress plugins.
  • Installed and configured WP Super Cache but, as yet, it doesn’t seem to be actually doing anything (the administration page tells me that nothing has been cached). I’m sure I’m doing something wrong here!
  • My MySQL database has been tweaked considerably during the past couple of days and I am fairly happy with the performance there now.
  • I will have to make an effort to reduce page weights by reducing image file-sizes (currently the heaviest content I am delivering by far).
  • I’m investigating PHP accelerators and need to learn which of them play nicely with WordPress.

Obviously I’ll document things here as I progress.


// 12.Jul.2008

MySQL Search and Replace

MySQL

Performing a case-sensitive search-and-replace through a table is easy with MySQL when you know how.
update table_name set table_field = replace(table_field,'replace_that','with_this');
So, for example, let’s say you have a table called “posts” with a data stored in a field called “content” and you want to replace all instances of the word “dog” with “cat”, then your SQL would look like this:
update posts set content = replace(content,'dog','cat');
How cool is that?