Premature optimisation
Premature optimisation is the root of all evil (or nearly) in programming: first make it work, then measure where it is slow.
There's a type of programmer who spends three days making a function lightning fast when it is called once a year, on 1 January, to print a New Year greeting. He gains four milliseconds. He celebrates as if it were the Moon landing.
The point of the phrase is common sense: you don't know where the slowness is until you measure. Optimising blindly makes the code unreadable and leaves the real bottleneck untouched, which is usually a query run inside a loop.
My uncle optimised his cellar: shelves in alphabetical order, indexes, a cache of his favourite bottles. Then he realised the door was locked and the key was in the cellar. Access time was infinite, but very well organised.