Skip to content

Instantly share code, notes, and snippets.

Created May 9, 2014 15:40
Show Gist options
  • Save anonymous/234562aa7013aec995a9 to your computer and use it in GitHub Desktop.
Save anonymous/234562aa7013aec995a9 to your computer and use it in GitHub Desktop.
SELECT
ServerObject.Name,
storageYesterday.Committed AS committedYesterday,
storageToday.Committed AS committedToday,
ROUND((storageToday.Committed - storageYesterday.Committed) / 1024 / 1024 / 1024) AS DifferenceGB
FROM
ServerObject
LEFT OUTER JOIN
StorageUsedByVm AS storageYesterday ON
storageYesterday.VcenterId = ServerObject.VcenterId
AND storageYesterday.Date = CURRENT_DATE() - INTERVAL 1 DAY
LEFT OUTER JOIN
StorageUsedByVm AS storageToday ON
storageToday.VcenterId = ServerObject.VcenterId
AND storageToday.Date = CURRENT_DATE()
WHERE
ServerObject.Disabled = 0
GROUP BY
ServerObject.Name
ORDER BY DifferenceGB DESC
LIMIT 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment