Indeed. But then you would not need 5000 threads but just two. That's how I read it. In the context of, say, a webserver 5000 threads is a valid proposition.
In the context of database operations a decent database should be able to maintain integrity. In that case the programming should be done database side.