ModelReflection DbSizeEstimate -> How does it work?

Hi all, Does anybody have experience with the DbSizeEstimate part of the MxModelReflection module. I can not find how this should be working. There is an entity in the default domainmodel, namely DbSizeEstimate and a Microflow to recalculate the DB size:  IVK_RecalculateSize. The first MF activity always gives zero results. This is, in turn, because the DbSizeEstimate object is nowhere created in Mendix. I checked for Java actions, but can't find involving the relevant java Class either... So, feels a bit like an idle part of the Mx ModelReflection to me. For such a technically vital module, available in almost all Mendix Apps I worked on, the documentation is very, very poor....  
3 answers

That feature in Model Reflection is something I started developing a long time ago, and actually forgot it was still there. Based on the data model, attribute types and lengths it is possible to make a fairly accurate estimate of the maximum sizes for your tables (with the exception of indexes). We know the types and how many bytes integers/longs/dates/etc consume, we can also make a decent estimate based on string lengths, and with a lot of math you can make a good forecast of the potential sizes.


The idea was that based on the info known about the entities, you would be able to add max/expected quantities for each entities and the module would give you an indication of potential table sizes. 

However since this has never been finished, this should actually have been removed a long time ago since it was never finished.


I don't have experience with the DbSizeEstimate functionality of MxModelReflection. Looking at the model I would have to agree with you that it seems like parts of this functionality are missing. If you change the access rules on DbSizeEstimate so that you can create (and delete) and that you have write access on the members, you could create a record for an entity that your are interested in. After that the Recalculate All microflow does is job of guestimating the size of the table.


I know it has little to do with the ModelReflection functionallity but if you are looking for a way to find the largest tables I usually use this in PgAdmin

SELECT oid::regclass, pg_size_pretty(pg_total_relation_size(oid))

 FROM pg_class

 WHERE relkind = 'r'

 ORDER BY pg_total_relation_size(oid) DESC

 LIMIT 20;


On the point of DbSizeEstimate, the calculations are really rough estimates (with fixed sizes / averages for certain attributes types etc). I guess it never was developed to a fully working state.