How to find all of the database's partitions efficiently, full table scan