Tuesday, July 21, 2026

script to find out DB size in Snowflake database

 


SELECT

    USAGE_DATE,

    DATABASE_NAME,

    ROUND(AVERAGE_DATABASE_BYTES / POWER(1024, 3), 2) AS DATABASE_GB,

    ROUND(AVERAGE_FAILSAFE_BYTES / POWER(1024, 3), 2) AS FAILSAFE_GB,

    ROUND(AVERAGE_HYBRID_TABLE_STORAGE_BYTES / POWER(1024, 3), 2) AS HYBRID_TABLE_GB,

    ROUND(AVERAGE_ARCHIVE_STORAGE_COOL_BYTES / POWER(1024, 3), 2) AS ARCHIVE_COOL_GB,

    ROUND(AVERAGE_ARCHIVE_STORAGE_COLD_BYTES / POWER(1024, 3), 2) AS ARCHIVE_COLD_GB,

    ROUND(AVERAGE_ARCHIVE_STORAGE_COOL_FAILSAFE_BYTES / POWER(1024, 3), 2) AS ARCHIVE_COOL_FAILSAFE_GB,

    ROUND(AVERAGE_ARCHIVE_STORAGE_COLD_FAILSAFE_BYTES / POWER(1024, 3), 2) AS ARCHIVE_COLD_FAILSAFE_GB

FROM SNOWFLAKE.ACCOUNT_USAGE.DATABASE_STORAGE_USAGE_HISTORY

ORDER BY USAGE_DATE DESC, DATABASE_NAME;



SELECT

    USAGE_DATE,

    DATABASE_NAME,

    ROUND(AVERAGE_DATABASE_BYTES / POWER(1024, 3), 2) AS DATABASE_GB,

    ROUND(AVERAGE_DATABASE_BYTES / POWER(1024, 2), 2) AS DATABASE_MB

FROM SNOWFLAKE.ACCOUNT_USAGE.DATABASE_STORAGE_USAGE_HISTORY

ORDER BY USAGE_DATE DESC, DATABASE_NAME;


1 comment:

  1. This is a very informative and well-written blog. I really enjoyed reading it because the information is presented in a simple and easy-to-understand way. The points you shared are practical and useful for anyone who wants to learn more about this topic. I especially liked how you explained everything step by step, making it easy for readers to follow. The examples and insights add great value and make the content even more engaging. Thank you for taking the time to create such a helpful article. I look forward to reading more of your blogs in the future. Keep up the excellent work and continue sharing such valuable knowledge with your readers! Best Fashion Designing institute in Delhi NCR
    Art & Craft Institute in Delhi
    business analytics course in delhi ncr

    ReplyDelete