Databases are specialized programs/libraries made for reading and writing parts of data.
You've probably noticed that the only way to read KeyValues file is to read the entire file in one go. Same with writing one to disk.
There are all sorts of techniques DBs use to make their lookups faster. A few are:
- Indexing. An index stores a key and the address of the start of the DB row that key corresponds to. Incidentally, you should create indexes on any columns you plan on doing lookups on (such as Steam ID)... and ONLY on those columns as too many indexes slows down INSERT/UPDATE queries.
- Caching. If you just run the same SELECT query and the data hasn't changed, it can just return the cached results.
(I'm sure I could come up with more if I stopped and thought for a bit, but I keep being interrupted while writing this.)
There are other DB optimization techniques that are probably far outside the scope of this discussion.
__________________