in reply to Inefficient search algorithm?

You can use a LIMIT clause on your SELECT to limit the number of entries returned. Check the docs for whatever RDBMS you are using.