Your question is a bit confusing, first of all, dynamics 365 online doesn't expose the database, in fact, only the Microsoft premier support team can scan it for performances issues or error messages, some of what you want to get is possible, but requires multiple instructions
SDK/WebAPI
You can get the metadata information using .NET SDK instruction (RetrieveAllEntitiesRequest) or querying the WebAPI directly (in Browser or Non-microsoft languaje, this requires previous register of your app in the Azure-AD of the instance)
If you are working with MS Dyn Onpremise and you have access to the database, you should use the set of views with the "Filtered" Prefix, you could get the Metadata consulting the information_schema and executing the count statement for each of them.
Hope it Helps
Regards