Tuesday, January 20, 2009

Change we can believe in

I've finally found the words to articulate how I feel right now.

I feel like that great air-breathing fish, Admiral Ackbar; as he leans back and sighs with relief and awe, the other fish-men in the rebel corsair cheer as the disabled super star destroyer crashes into the death star.

Friday, January 16, 2009

Why PHP won

I've run out of patience with PHP, but I've always recognized the coexistence of its strengths and its weaknesses that narrower minds refused to acknowledge. Some CTO has a long post essentially arguing this.

I first learned PHP in January 2000. I remember the date exactly. This was only shortly after 4.0 had just come out. I had some acquaintances who were using PHP 3 but I had never tried it.

For awhile I loved PHP. Being used to the fixed-memory limitations of the data structures of C/C++ and mysterious segfaults I often couldn't understand, I found PHP to be incredibly liberating.

Wednesday, January 14, 2009

stupid mysql tricks


what do you know, screencasting works!

Monday, January 5, 2009

The new way to do show processlist

We all know and love the show processlist command to see what our queries are doing.

However, most of the show commands are being deprecated in favor of new information_schema virtual tables. (I believe the technical term is actually "system view".)

The new information_schema equivalent of show processlist is:

select * from information_schema.processlist \G

*************************** 1. row ***************************
     ID: 259584
   USER: readonly
   HOST: 192.168.0.186:44761
     DB: bln
COMMAND: Query
   TIME: 222
  STATE: Writing to net
   INFO: SELECT /*!40001 SQL_NO_CACHE */ * FROM `person5`
*************************** 2. row ***************************
     ID: 259468
   USER: readonly
   HOST: 192.168.0.108:43492
     DB: bln
COMMAND: Query
   TIME: 0
  STATE: executing
   INFO: select * from information_schema.processlist

The ID column appears to be the connection_id of the thread that is running the query.

The advantage of this method is that we can filter the results with a where clause, like so:

select * from information_schema.processlist where command <> 'Sleep' and id <> connection_id();

which will show only those queries that are not in sleep mode and excludes the current process.