Speed up of database search