Getting tables and tablesizes

Posts   
 
    
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 08-Oct-2009 23:26:43   

Hello, I have a system running, where I need to monitor thesize of the database a bit more closer.

For this purpose I wanted to create an overview of DB usage, consisting of the following:

List of all tables in the schema. For each table, I want to print out the record size and the record count.

Any ideas on how to do that with llblgen???

Thanx in advance for your suggestions, Paul

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Oct-2009 05:35:17   

Hi Paul,

Shouldn't it be easier to write an SP and return the result via LLBLGen? Also remember that LLBLGen is an OR/Mapper and one of its features is that you can choose what tables/fields to be mapped, so the final llblgen objects doesn't neccesary correspond to the number of tables and number of fields in your db. Are you using Adapter or SelfServicing?

David Elizondo | LLBLGen Support Team
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 09-Oct-2009 08:36:52   

Hello Daelmo,

In response to your comments: - I don't consider writing an SP easier ... sorry. I'm used to deal with the database through llblgen objects. Maybe you're right tough, wouldn't know! - I make sure that my generated code is always 100% synchronised with the database. - Selfservice.

I'd rather do something with reflection ... Looking for all CollectionObjects, then for each collection calculating record size and subsequently doing a query per table requesting a record count. Put everything in a small table et voila ...

Then I was hoping .... could there be an easier and more precise manner?

Anybody?

Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 09-Oct-2009 12:22:43   

Daelmo, Your comments made me think about using the sp option a bit more. At first i did not get that to work, but now I've been able to call sp's. I found one especially interesting sp ie: sp_spaceused ...

Works like a charm. So, this issue has been solved. Thanx for your help! Paul