Improve the performance of your application by implementing correct logic for a particular problem.
It is important to create good indexes so that your queries do not unnecessarily need to scan many rows, that can result in lock on those rows and due to which deadlocks can occur, performance can be degraded, or anything bad can happen.
When designing an application or database, also consider other scenarios and pros and cons of the approach being adopted, not only one scenario. In other words if one approach is solving your problem then also consider what other problems we can face due to it, and prepare for those as well.
Always use referential integrity constraints. There is no reason for not using it.
If result of a function is needed more than once then don’t call that function multiple times. Save the result of that function in a variable and use that variable instead.