Index the crap out of it!

There’s something satisfying about seeing a particularly complicated database query’s execution time go from 0.7 seconds to 0.02 seconds. I’m working on a tricky report for a client whose database has tens of millions of rows, and I was becoming frustrated with the sluggish queries. So I sat down and started looking at the query, testing its performance, until I saw a couple of fields that I could index. I ran a few commands to do so, and BAM, it sped up by a factor of almost 40.

A wise man (I think it was Brian) once told me that the solution to most database query performance problems is to “index the crap out of it”. So true.

60 in February

I couldn’t let a sunny 60-degree day in February go to waste. I joined five die-hard friends in a game of Durango boot (a variation on ultimate) at lunchtime today. We played on a slushy, snowy field, and 15 minutes into the game none of us could feel our toes any more. But we were slipping and sliding and having a great time. Ahh, February in Colorado…

Hun

I thought there was some kind of law that says the only people who can call me “hun” are women over the age of 60. Coming from a matronly older woman, it’s kind of an endearing term. Coming from the 20-something sandwich artist at Subway today, it somehow seemed wrong.

Well, that escalated quickly.

Today I was driving and my tire pressure light came on. Sigh. It does this about every two weeks, and I drive over to the nearest gas station and fill up the tire again. It costs a dollar in quarters every time, but I figure it’s cheaper than buying a new tire.

I returned home, parked in the garage, and as I was heading into the house I heard a hissing sound. Looking more closely, it was that same tire… hissing as the air escaped at a steady rate. Sigh.

So I drove over to the local Tires Plus and asked them to plug it. They told me they’d call me with an update. A few minutes after I returned home, they called to say there was a huge nail in the tire and it wasn’t reparable. I’d have to replace the tire. Sigh.

Well, you never replace just one tire– you need to do at least a pair. I asked about that, and he said, “All of your tires are pretty much bald. You should replace all of them.” Since it’s winter, and in fact snowing pretty heavily today, I suppose it makes sense. So sure, go ahead and replace all four tires. Sigh.

“Oh, and by the way, your alignment is way off.” How much is that? Another $150 for an alignment today and for the rest of the lifetime of the car (actually not a bad deal). Without the alignment, the tires will wear unevenly and all sorts of other bad things. I suppose I also won’t be able to drive on I-70 through Kansas without touching the steering wheel. So sure, let’s align everything too. Sigh.

$800 later, I walked out of the shop. All because of a nail.

On a humorous note, “that escalated quickly” reminded me of the old “I saw a spider” meme:

there-was-a-spider-i-panicked

Sometimes it’s good to be a geek

Today I’m in Dallas, attending a NASA meeting in hopes of finding ways to expand our web application amongst various groups within NASA. It’s at a Marriott hotel, so I spent the bulk of the day in a conference room watching presentations. Between those presentations (and, I admit, during some of them), I was checking email and writing to various people.

A bunch of my emails bounced back to me as undeliverable because the receiving servers refused them. Apparently the outbound IP address here at the Marriott is on a spam blacklist. Awesome. Most likely, some enterprising guest (or many of them) decided to use the hotel’s wireless connection for their fun and profit at some point. The bottom line was that I couldn’t send email through my servers because the origination point was being blacklisted.

Fortunately I’m a geek. After a few minutes’ thought, I set up an SSH tunnel to one of my servers and used it to route SMTP traffic through a local connection. I was able to completely bypass the hotel’s IP address as an origination point for the email, and when I re-sent those blocked messages, all was well. I kept the tunnel up for the rest of the day, and all of my ongoing messages worked fine.

Bam. SSH tunnels rock.

Now that’s a tooth

Zack has the same problem Laralee and Alex do: he doesn’t have any permanent canines in his mouth. So he has baby teeth that don’t have anything above them, and they’ll never get pushed out of his gums. That’s not entirely bad– Laralee was over 40 when we finally had those two baby teeth removed as part of her whole braces saga. But we had Alex’s removed, and the orthodontist was able to shift some things around with Alex’s braces to make his mouth look good. Now it’s Zack’s turn.

The dentist told Zack he could attempt to pull the tooth himself by wiggling it over the span of a month or two. Since it’s just a baby tooth, working on it can eventually loosen it so it can be pulled. That would save us the $80 extraction fee for the dentist to remove it. So Zack worked at it– every time he was watching a movie or reading a book, he’d be tugging at this tooth. But he didn’t feel like he was really getting anywhere.

Yesterday he visited the dentist to have some cavities filled, and Laralee decided to go ahead and have the tooth extracted. As it turns out, it seems unlikely Zack would have been able to pull it himself by just wiggling it:

zack-tooth

That little sucker had a root that was about 3/4″ long! It wasn’t going anywhere…

Saving the world

My latest board game is Pandemic, which is pretty quick to play and a lot of fun. In it, diseases are breaking out all over the world and it’s a race to cure them before they cause outbreaks and epidemics.

pandemic-1

pandemic-2

The game developers did a good job of balancing things so the game is a bit of a white-knuckler. You’re either right on the brink of disaster when you triumphantly save the world, or the diseases explode out of control and kill billions. A nice way to spend an evening!

Ack… bar

I’m toying around with a new Linux command-line tool called ack. It’s a replacement for the old standard, grep. Possibly the best feature I’ve found is the “bar” option, which does this:

# ack --bar
                      ?IIIIIII7II?????+
                   ~III777II777I?+==++==+:
                  ???I7I???I7II++=====++===
                 ??+??????????+===~~=+++??==+
                ??+??II??????+==~=~~=+++++==++
               I+?????????+?+====~=~==+==++?==?
              ?????II?????+++++=======?===~~~~==
            ,?????II????????++++====~===::~~~~:~
            I?I??II?+++??+?+++==~~~~:~:~:,:,,:::~
           I??????+==+???++++=~~:~:~:,:::,:,,,,,::
          +I?++++=+=+????+++=~~:~~:::,,,,::,,,:,:
          I??+?+====+???+++===~~::::,::,:,,,,,,::
         I????=~===++?+=+=~==~:~~:,,,,,,,.,,,,,:~
        =??+?=~~~~??+?+===~~==,==~~~~,,,,..,,,.:=
        II++==~~=++++++=~~=~,~+=?+?=I?++=..,.,,:
     IIII?+?=====+~+++~=~~~:::=~+~===:,,,,,.,.::
    I?=?I+??+=~=~?I?=+=~~~::,~~=~::~=::,,,,,,::       ---------------
    ?+I??++=++~,::+++~~~:::,,=~~=,~,..,::.:          / It's a grep! /
    ++=+?++~=:~::I+,~=:~,:,,,,:~~......::~,,,        ---------------
     ~=~=:.++~:,.,~=::::.,,:,.:~,:=...==~,::              /
     =~?++??+=~~,.:?~.:,:,,,.,::,,~:=~=::,~              /
     ++~~:~===~:~,.~::,~=~.:,..,:,,:==:.,:7             /
     ~~,::...:=:,::+:~:.,~,...,.,,,,::~,,::~=          /
      =~===+=~~,.::,,,:::,..,,,,,,,,,,,:,..,=+?
      ~=~=~::~~~::,.,,,~:.+,..,,,,..,,,,...,+I?
      ~==~:~~:~~,~=~~:,:~,:,,,,,,....,,,..+?I?I
      ~=~=+,:~:=,:~~~~~~::::,.,,.,,.,,,..~+????I
      ~=~==~=:~~:,~~~~~:::,::,.,,,..,,,I77I?+??II
      +I7:::~~=~:,::~~~~.=.,~,,,,...,~7III?+??II7
     777?+~:=~=~~:,::~~:::.,,,,,,,,,777II??I777777
     777I==:=~::~~~~::~:::,:,:~:::,777I???777777777
    7777+,~===~:~:~~~~:::,.~:=,,:777II???77777777777=?
    777I~,~~~=~::~:,:,,,:=~~,,:7777I???I7777777777+=++
  I7777I,,:,.==::::,:,,,,::::7777I+??I77777777777??I7I7,
 ,77777I::,..~~:,,,,,,.,:~I7777I+??I777777777777?I7777777,
 77777777,...~~:,,,,,.,77777I7???II777777777777+?7777777777
77777777777:,~~~,,=7777777I???II777777777777777+77777777777
77777777777777777777777I+7?7II77777777777777777+777777777777

Genius!