I really doubt if the problem has to do with the tables being used or the way the SELECT(s) is/are being constructed. The OP is retrieving all documents for a company code. If there are a large number of documents, it will take time.
There is no getting around that.
Rob