Microsoft published guidance for SharePoint 2010 on how to calculate an estimated size of a content database.
The formula is very simple:
Database size = ((D × V) × S) + (10 KB × (L + (V × D)))
On the train to work this morning I wrote a little bit of JavaScript to help automate this calculation. You can try it out live here, or grab the code below for yourself.
[js]
function UpdateDBSize() {
// Pull all the data and elements that we’re going to need in to local variables
var d = document.getElementById(“capcalc_D”).value;
var s = document.getElementById(“capcalc_S”).value;
var l = document.getElementById(“capcalc_L”).value;
var v = document.getElementById(“capcalc_V”).value;
var dErrMsg = document.getElementById(“capcalc_DErrMsg”);
var sErrMsg = document.getElementById(“capcalc_SErrMsg”);
var lErrMsg = document.getElementById(“capcalc_LErrMsg”);
var vErrMsg = document.getElementById(“capcalc_VErrMsg”);
// Validate each number, set error message visibility if not
var allValid;
allValid = Validate(d, dErrMsg);
allValid = allValid & Validate(s, sErrMsg);
allValid = allValid & Validate(l, lErrMsg);
allValid = allValid & Validate(v, vErrMsg);
var answerElemKB = document.getElementById(“capcalc_answerKB”);
var answerElemMB = document.getElementById(“capcalc_answerMB”);
var answerElemGB = document.getElementById(“capcalc_answerGB”);
if (!allValid)
{
answerElemKB.innerHTML = “N/A”;
answerElemMB.innerHTML = “N/A”;
answerElemGB.innerHTML = “N/A”;
} else {
// Convert all to numbers
d = parseInt(d);
s = parseInt(s);
l = parseInt(l);
v = parseInt(v);
var dbSizeInKB = (d * v * s) + (10 * (l + (v * d)));
var dbSizeInMB = (dbSizeInKB / 1000).toFixed(2);
var dbSizeInGB = (dbSizeInKB / 1000000).toFixed(2);
answerElemKB.innerHTML = dbSizeInKB.toString().replace(/B(?=(?:d{3})+(?!d))/g, “,”) + ” KB”;
answerElemMB.innerHTML = dbSizeInMB.toString().replace(/B(?=(?:d{3})+(?!d))/g, “,”) + ” MB”;
answerElemGB.innerHTML = dbSizeInGB.toString().replace(/B(?=(?:d{3})+(?!d))/g, “,”) + ” GB”;
}
}
function Validate(val, errMsgElem) {
if (isNaN(val)) {
errMsgElem.innerHTML = ‘Please enter a non-negative integer’;
errMsgElem.style.color = “Red”;
return false;
} else {
errMsgElem.innerHTML = ‘OK’;
errMsgElem.style.color = “”;
return true;
}
}
[/js]
Operand | Mnemonic | Value | Value OK? |
---|---|---|---|
Number of Documents | D | ||
Average Size of Document (KB) | S | ||
Average Number of List Items | L | ||
Average Number of Versions | V |
[js] UpdateDBSize(); [/js]
Let me know if you find this useful, or spot anything wrong!