This tech startup has a problem with a database query — even when the data doesn’t change, it doesn’t always give the same answer, reports a pilot fish who’s brought in to help out.
“The data was a table where each tuple represented a single answer on a ten-question yes/no quiz given to a few hundred people,” fish says. “It was designed using a desktop data modeling tool, and super-normalized to fifth normal form.
“The query was a self-join that was so complex it filled an entire screen even if all the decorative indentation was removed, and it ran for 20 minutes. It was non-commutative, too; swap the self-join clauses around, and you’d get a different answer.”