Database indexes and locks
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.