How to Query Your DB for Repository Size
You can obtain the size value for each node in Artifactory from thebin_lengthcolumn of thenodestable in your Artifactory schema. The sum of all of the rows in this column will tell you the amount of physical storage space that would be occupied if each artifact was a physical binary (i.e., the size of a given artifact includes the possibility of its duplication).
Following are two,SQLquery examples. The first seeks to learn the size of the repository in bytes, while the second will return the same information in MB:
SQL Query #1:
SELECT SUM(bin_length) from nodes WHERE repo='ext-release-local';
Result:
+—————–+
| SUM(bin_length) |
+—————–+
|382713706|
+—————–+
1 row in set (0.00 sec)
SQL Query #2:
SELECT CONCAT(SUM(bin_length)/1000000,'MB') from nodes WHERE repo='ext-release-local';
Result:
+————————————–+
| CONCAT(SUM(bin_length)/1000000,'MB') |
+————————————–+
|382.7137MB|
+————————————–+
1 row in set (0.02 sec)
Of course, both of these queries can be applied to any repository, not just the ext-release-local repository.
