Modified subquery to handle >16TB databases.

fornerly, query would results in an arithmetic overflow error if total database size >16TB.