Skip to content

Instantly share code, notes, and snippets.

@Migaroez
Created June 18, 2024 12:13
Show Gist options
  • Select an option

  • Save Migaroez/a26e0659f1bce3e442722e4c670531b9 to your computer and use it in GitHub Desktop.

Select an option

Save Migaroez/a26e0659f1bce3e442722e4c670531b9 to your computer and use it in GitHub Desktop.
Rough Umbraco node size estimation
select un.uniqueId, cv.nodeId, cv.id as versionId, totalVersionSize.totalValueSize, versionPropertyCount.propAmount
FROM umbracoContentVersion cv
left join (
SELECT versionId, Sum(
(coalesce(DATALENGTH([intValue]),0)
+coalesce(DATALENGTH([decimalValue]),0)
+coalesce(DATALENGTH([dateValue]),0)
+coalesce(DATALENGTH([varcharValue]),0)
+coalesce(DATALENGTH([textValue]),0)))
AS totalValueSize
FROM umbracoPropertyData
group by versionId
) as totalVersionSize on totalVersionSize.versionId = cv.id
left join (
select pd.versionId, count(distinct pd.id) as propAmount
FROM umbracoPropertyData pd
group by versionId
) as versionPropertyCount on versionPropertyCount.versionId = cv.id
left join umbracoNode un on un.id = cv.nodeId
order by totalVersionSize.totalValueSize desc
select un.uniqueId, cv.nodeId, cv.id as versionId, totalVersionSize.totalValueSize, versionPropertyCount.propAmount
FROM umbracoContentVersion cv
left join (
SELECT versionId, Sum(
(coalesce(DATALENGTH([intValue]),0)
+coalesce(DATALENGTH([decimalValue]),0)
+coalesce(DATALENGTH([dateValue]),0)
+coalesce(DATALENGTH([varcharValue]),0)
+coalesce(DATALENGTH([textValue]),0)))
AS totalValueSize
FROM umbracoPropertyData
group by versionId
) as totalVersionSize on totalVersionSize.versionId = cv.id
left join (
select pd.versionId, count(distinct pd.id) as propAmount
FROM umbracoPropertyData pd
group by versionId
) as versionPropertyCount on versionPropertyCount.versionId = cv.id
left join umbracoNode un on un.id = cv.nodeId
order by versionPropertyCount.propAmount desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment