<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Get the Size of Filtered Rows in Databricks SQL in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109259#M43261</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113924"&gt;@vidya_kothavale&lt;/a&gt;&amp;nbsp;try this code block. Keep in mind to handle the null values.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SELECT 
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) as bytes,
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) /POWER(1024,2) as mb,
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) /POWER(1024,3) as gb 
FROM catalog.schema.table where ts &amp;gt;= '2025-02-04 00:00:00' AND ts &amp;lt; '2025-02-05 00:00:00';&lt;/LI-CODE&gt;&lt;P&gt;Let me know for anything, else mark it as solution.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2025 17:28:11 GMT</pubDate>
    <dc:creator>MadhuB</dc:creator>
    <dc:date>2025-02-06T17:28:11Z</dc:date>
    <item>
      <title>How to Get the Size of Filtered Rows in Databricks SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109097#M43221</link>
      <description>&lt;P&gt;I have a query that filters rows from a table based on a timestamp range. The query is as follows:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class=""&gt;COUNT&lt;/SPAN&gt;(&lt;SPAN class=""&gt;*&lt;/SPAN&gt;) &lt;SPAN class=""&gt;FROM&lt;/SPAN&gt; table_name &lt;SPAN class=""&gt;WHERE&lt;/SPAN&gt; ts &lt;SPAN class=""&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;'2025-02-04 00:00:00'&lt;/SPAN&gt; &lt;SPAN class=""&gt;AND&lt;/SPAN&gt; ts &lt;SPAN class=""&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;'2025-02-05 00:00:00'&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;This query returns 10 rows. I need to calculate the total size (in bytes) of these 10 rows.&lt;/P&gt;&lt;P&gt;What is the best approach in &lt;STRONG&gt;Databricks SQL&lt;/STRONG&gt; to get the exact size of these filtered rows?&lt;BR /&gt;is there a built-in function to get this information?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 08:14:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109097#M43221</guid>
      <dc:creator>vidya_kothavale</dc:creator>
      <dc:date>2025-02-06T08:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get the Size of Filtered Rows in Databricks SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109218#M43245</link>
      <description>&lt;P&gt;You'd have to write the results to a table, then do&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;I&gt;DESCRIBE DETAIL table_name&lt;/I&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;and look for the column sizeInBytes&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 14:37:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109218#M43245</guid>
      <dc:creator>holly</dc:creator>
      <dc:date>2025-02-06T14:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get the Size of Filtered Rows in Databricks SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109259#M43261</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113924"&gt;@vidya_kothavale&lt;/a&gt;&amp;nbsp;try this code block. Keep in mind to handle the null values.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SELECT 
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) as bytes,
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) /POWER(1024,2) as mb,
    SUM(OCTET_LENGTH(CAST(column1 AS STRING)) + OCTET_LENGTH(CAST(column2 AS STRING)) + OCTET_LENGTH(CAST(COALESCE(column3, '0') AS STRING))) /POWER(1024,3) as gb 
FROM catalog.schema.table where ts &amp;gt;= '2025-02-04 00:00:00' AND ts &amp;lt; '2025-02-05 00:00:00';&lt;/LI-CODE&gt;&lt;P&gt;Let me know for anything, else mark it as solution.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 17:28:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-size-of-filtered-rows-in-databricks-sql/m-p/109259#M43261</guid>
      <dc:creator>MadhuB</dc:creator>
      <dc:date>2025-02-06T17:28:11Z</dc:date>
    </item>
  </channel>
</rss>

