databases

You are currently browsing articles tagged databases.

I’m taking some time to tidy things up around here, so I’m coalescing a bunch of one-liners into a single post:

  • Smashing Magazine generates linkdump posts faster than I can digest them. This one from April 2008 on creative web form design is one of their best. Lots of inspiration there.
  • O’Reilly Radar’s Marc Hedlund on Code Review Software.
  • . If you’re concerned with database scaling and used to thinking in terms of ACID, there’s a lot to mull over here.
  • Design Principles and Design Patterns is the clearest description of object composition I’ve ever read. Rather than the standard, 15-year-old “Fido’s a Dog, Dogs are Mammals, Mammals are Animals” object hierarchies you get in Introductory OO texts, it’s a short, readable explanation of how to design objects that are maintainable, extensible and loosely coupled. Really really good stuff.
  • A Neat Approach to Narrow Windows. Concept 64’s clever way to deal with varying page widths is firmly grounded in usability. If the page width is >800 pixels, the navigation links style themselves as a left-hand navigation menu. As the page width drops below 800 pixels the navigation links restyle themselves as tabs. Easy to do in Javascript by swapping CSS rules around, but a lot of thought has obviously gone into the design here. [It looks like the site's been taken down (wayback link, no javascript). I'm keeping the link because I hope it comes back at some point.]
  • Peterbe’s experiences at the 2006 Google London Automation Test Conference. And… wow, I’m back to 2006 already. I sure don’t post much. Anyway, unit testing is one of those things that I desperately want to use in commercial projects, but when you say to management “I want to spend two weeks writing code that won’t make it into the final application” they get a funny look in their eye. Much the same thing happens when I start talking about user stories. Or the separation of presentation and business logic. Not that I’m bitter, or anything.

I just spent 10 minutes tracking down this particularly opaque MySQL command:

SHOW PROCEDURE STATUS

Followup. To list views:

SELECT * FROM information_schema.views

To list stored procedures and functions:

SELECT * FROM information_schema.routines

I really should have these bits and pieces committed to memory already, but as most of my job currently consists of fire-fighting in other peoples’ code, I don’t get to use sensible features like SPs and views very often.

ERROR 1116 (HY000): Too many tables; MySQL can only use 61 tables in a join

If you ever run into this MySQL error, something has gone badly wrong with your database schema. In this case, the database had no foreign key constraints, and I was trying to build a DELETE query that cascaded across ~230 tables. Not pretty at all.

It didn’t help that there was no documentation and no consistency in key names – id, clientid, client, fkClient, they all referred to the same key in different tables.

After a few false starts, I gave up on doing the deletes by hand; instead I went through the database creating the foreign key constraints that should have been there in the first place. It’s the same amount of work, I end up with a slightly saner database (always leave the codebase better than you found it), and doing the delete becomes a simple “delete clientid”, which cascades through the rest of the tables removing related data.