Do SQL queries directly instead of linearly searching the database.