Here is a way to get some random rows from MySQL:
mysql> SELECT id FROM record ORDER BY RAND() LIMIT 5;
It is apparently slow, but works fine for one-offs.
From the MySQL docs:
The default character set and collation are latin1 and latin1_swedish_ci, so nonbinary string comparisons are case insensitive by default.
... so if you were trying to do something like this:
SELECT * FROM thetable WHERE colname REGEXP '^[A-Z]';
... and you were wondering why you were getting back results where colname started with lowercase letters too, this is why! Try this instead:
SELECT * FROM thetable WHERE colname COLLATE latin1_bin REGEXP '^[A-Z]';
I don't like MySQL, I would recommend PostGreSQL over it any day. However we are often forced to use things we don't like (for example at our workplaces!) so here is some info to help tune MySQL for speed:
MySQL Tuner is a Perl script that gives you a list of recommendations on settings to change. It seems easy and sensible! Just run it and it asks for user/pass settings and then gives you a little report.
Django Python 960.gs Git Vim NetBSD Nginx
This is the blog of Brad Willis, a software engineer living in Brisbane.
Help
Latest entries
*BSD Agile Apache Apple apt Athletics Best-Practice Censorship Comedy Cool Crosswords Deployment Django English Exim Firefox Git Hardcore Health irssi Javascript Jira Languages Linux Makefile Mathematics Mobile Broadband Mutt MySQL NetBSD nginx Nokia OpenVZ OSX Perl Privacy Python Rant Requirements rsync Ruby Shell Slackware SQL SQLite SSH Standards Subversion Television Testing ThisBlog Vim VMWare (Fusion) VPN X zsh
Checking for exceptions in doctests
Homer's Curling Speech
retry in Python
Vim Makefile tabs
Centos (or RH) IPTables
Converting ssh2 public keys to openssh
Vim comment hints
Context managers in Perl
Dish rotation
Git - fixing commit user
apt stuff
Using shell variables in AWK
Linux - Too many open files
Tell gvim to save and quit... remotely
Vim - automatically remove whitespace at EOL
Python - relative paths from within modules
TV Aspect Ratios
Git - Which commits are in your branch only?
Subversion setup cheat sheet
Force detach a screen session
Modify sudo's use of environment variables
Install all Perl modules
Mutt - delete old messages
OpenVZ VPS and swap space
fail2ban on NetBSD for ssh
NetBSD - Using sup
Python - testing for a sys.exit
Python Best Practice Link Dump
Python script names
Perl - Using an expensive module
Speed of git clone
Perl Modules with Custom Prefix
Perl: tr vs. s
Brilliant sysadmin Reference
Why is GRUB better than LILO?
Why is swap space important?
Perldoc Output
Git's Index
Jira Project Keys
Git GUI