Archive for April, 2018

Cost of forgetting to create database index when needed

08 Apr

Spending the weekend cleaning up and refactoring a project i maintain which i wrote with Python-twisted, i discovered a certain database call seemed to be taking too much time to return.

Time before call: 17:01:16.206000
Time after call: 17:01:24.092000

That is a whooping 7.886 seconds wasted per request.
I am of the habit of going back to my SQLs and looking out for the WHERE clauses to grab my index candidates but on this one, I probably added a fix which got me introducing some database look-ups without matching indexes.

Here is the result after the index fixes

Time before call: 17:26:25.533000
Time after call: 17:26:25.765000

Now this is one of those fixes that brighten your weekend.