By day, Matthew is a highly-paid consultant that travels around globe helping companies develop and optimize application databases. By night, he's a un-paid consultant for a friend that supports a massive, vendor-provided system that cost well in the six figures. And like many enterprisey systems, the quality is inversely proportional to the price.

"They sent me a patch to help speed up the ledger reconciliation report, but it doesn't seem to do anything," Matthew's friend told him, "in fact, it seems to make things go slower."

"Did you forward them exactly what I sent you?" Mathew asked. "When we did the query trace, it was clear that the problem was a lack of indexes on the inventory table."

"Right - and that's exactly what I told them, that the inventory table needed an index. That's apparently what the patch did, but it sure as hell didn't help. Got a few minutes to jump on and help?"

Matthew didn't mind - in fact, looking through this six-figure system offered a bit of schadenfreude. And when he saw the patch that the vendor provided, he nearly fell out his chair:

CREATE CLUSTERED INDEX idx_inv_items on #tbl_inv_items (item_id)

While the vendor's developer did indeed index the data, instead of applying the index to the table, they applied it to a temporary table... which was created every time the report was run.

Matthew explained all this to his friend, and told him how to tell the vendor to fix it. Hopefully, getting the vendor to implement the fix to the fix won't cost nearly as much in professional services.