sam said:
Right, this is for small number of users.
To deal with large number of users, one would need to load all user
records into memory when the system/server start up, and use hash/tree
to speed up the search rather than using linear search.
You asked to "search on the list base on _the_user_name_", so I deduced
that you were having a go at the database with a single user name (e.g.
when adding a user to a system). If you need to batch-process several
user names in one go, then, obviously, a hash would be a suitable data
structure.
The size of the database would also play a role: loading a huge database
into memory would require a lot of memory (which is cheap these days),
reading one record at a time would not, so that would involve a
classical time/space-tradeoff.
The next step, then, would be to consider converting your list of user
names into a database (eg using the DBM modules) and then working on
that rather than the more unstructured list of names.