You can get the size of each node in Artifactory from the ‘nodes’ table of the Artifactory schema. The size value of each node is available in the ‘bin_length’ column. By summarizing the entire value of the ‘bin_length’ of a specific repository, you can know the amount of physical storage that would be occupied if each artifact was a physical binary (in other words, artifacts size include duplication’s if there any).
Here are two examples. The first example returns the size of the repository in bytes, and the second example returns the size of the repository in MB.
SELECT SUM(bin_length) from nodes WHERE repo=’ext-release-local’;
| SUM(bin_length) |
| 382713706 |
1 row in set (0.00 sec)
SQL Query in MB:
SELECT CONCAT(SUM(bin_length)/1000000,’MB’) from nodes WHERE repo=’ext-release-local’;
| CONCAT(SUM(bin_length)/1000000,’MB’) |
| 382.7137MB |
1 row in set (0.02 sec)
Of course, both of these queries can be used for any repository name and not just for the ‘ext-release-local’ repository.