I have a database of strings (arbitrary length) which holds more than one million items (potentially more).
I need to compare a user-provided string against the whol
If your database supports it, you should use full-text search. Otherwise, you can use an indexer like lucene and its various implementations.