The biggest mistake you can make to cause problems with performance as a developer is to use joins. Inner or Outer Joins take up a lot of CPU. The transaction queries also take over 1000% time to complete in many cases.
If you have to join tables, you need to revisit your DB architecture. The worst thing you can do is to put a join into the code you send to the DB. For example, I just recently came across a client that had an issue with one particular transaction take over 5 minutes and it still wouldn’t complete.
After examining the code, the client realized there were joins across 2 DBs. When I originally asked him if there were joins, he swore up and down there weren’t. I guess he finally decided to look at the code only to find a Join in the code.
After cleaning it up, the transaction went from 5+ minutes to less than 5 seconds. So it is important to do code reviews people.
If you have to do a join at all (the worst thing you can you can ever do), You need to review the DB architecture. Hire a DBA people. Have someone review your architecture. You’ll save yourself some major pain in the long run. That’s a promise.
… and you won’t look like an idiot when the application craps out.