Data analysis

1
Hello, Our database space is running out so we're thinking maybe we should clean up any data that's not in use in the app. Is there any way to view some analytics on how much space what data (by entity) is taking up the database? The only thing I was able to find was datadog but it’s for Mendix cloud version v4, and we are running on Mendix cloud version v3.   Thank you.
asked
4 answers
5

Download a backup of the database and restore it locally in Postgres. Postgres has some analyses tools to see how much data each entity has.

Regards,

Ronald

 

answered
2

Just do it live on the system.

Using  com.mendix.core.Core.dataStorage() you can run SELECT pg_size_pretty( pg_database_size($YOURDBNAME) ) . This will provide you with an overview. Running  SELECT nspname || '.' || relname AS "relation", pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND C.relkind <> 'i' AND nspname !~ '^pg_toast' ORDER BY pg_total_relation_size(C.oid) DESC will provide you with an overview per relation.

For the cloudboxes, you can get the database name as follows:

com.mendix.core.Core.dataStorage().executeWithConnection(
	function(a){
		try{
		    dbname=a.getCatalog();
		}catch(e){
		    alert(e);
		}
	}
);

Sample output:

Overview:

Details:

 

answered
0

If your app is using Scheduled events, or sending out emails, it happens a lot that it is not considdered that that data is stored in the database.

I’ve seen apps with over 1.000.000 records in the scheduled event database table (System.ScheduledEventInformation) without anyone knowing it.

answered
0

Como podria hacer un analisis de datos que guardo en alguna entidad, con todos su atributos

answered