Assuming you're talking about SP2010, here are Microsoft's recommended size guidelines:
Technically speaking, you can have 30 million documents in a library. In practice, if you have a couple hundred thousand or more, let alone several million, I would strongly recommend setting up some kind of BLOB/archive storage solution for documents that are not perused on a regular basis. You are far more likely to bump up against the 200GB site collection limit (and as a general rule of thumb, it gets very, very hard to do restore operations on DBs larger than 50-75GB, and super-hard on ones bigger than 100GB).
What will happen if you have a doc library of this size is that:
- It will take forever to crawl. You might consider turning search off entirely.
- Running queries on the underlying DBs will also take a while, and the larger the library in question is, the longer it'll take to return results. You run queries basically any time you use a view or decide to sort by a particular column. I get people complaining about speed on a 50,000 item list; I can only imagine what people would say when a 9 million item library has to run.
- As noted above, if somebody breaks something, it's going to be a PITA to fix it via normal (i.e. site collection restore/backup) methods.
- When it comes time to upgrade to 2013, it's going to be a PITA to upgrade as well.
Perhaps some things you should be asking yourself and the decision-makers who want to do this:
- Which users are going to be using what files? If you have Group X constantly needing file set X but never file set Y, it may behoove you to create separate site collections with their own doc libraries for these groups and documents (I specify separate site collections because this would allow you to cordon them off into separate content databases as well, in turn making it easier to restore from backups and so on).
- Which files are going to be used regularly, which occasionally, which not at all? Even if you don't go the full BLOB route, creating a separate SQL instance for your BLOB server and the like, you can still differentiate between high-availability sites and files and medium-availability ones.
- Are these files just there for show or are you planning on using SP's document check-in/check-out settings? If they're all going to be read-only, you might consider turning off versioning. With versioning, of course, you are essentially saving multiple copies of the same document in a library, which, as you can imagine, can significantly increase the size of the library. If some are and some are not, you can have a library without versioning and one with.
Hope this can get you started.