A lot of what I had done for years (I moved to a new project last year) had to do with database queries and the next layer or two sitting on top of them. Periodically, it was my job to look at what queries were taking too long. While much of the time that involved in database optimization like adding indices, etc, sometimes there was truly horrible code sitting on top of the database. One of my favorites involved a list coming in, and the code created the first item on the list. Then it deleted everything associated with that list and created the first two items, etc, etc. Yuck.