<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vuppala Venkat on Medium]]></title>
        <description><![CDATA[Stories by Vuppala Venkat on Medium]]></description>
        <link>https://medium.com/@vuppala.venkat?source=rss-40f1b9d0f236------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EXdkJ3Gif-ahh6nRvJmBoQ.jpeg</url>
            <title>Stories by Vuppala Venkat on Medium</title>
            <link>https://medium.com/@vuppala.venkat?source=rss-40f1b9d0f236------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:31:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vuppala.venkat/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Snowflake warehouse sizing best practices]]></title>
            <link>https://medium.com/@vuppala.venkat/snowflake-warehouse-sizing-best-practices-27b3063b6261?source=rss-40f1b9d0f236------2</link>
            <guid isPermaLink="false">https://medium.com/p/27b3063b6261</guid>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[snowflake-cost-management]]></category>
            <dc:creator><![CDATA[Vuppala Venkat]]></dc:creator>
            <pubDate>Sun, 30 Jun 2024 20:38:59 GMT</pubDate>
            <atom:updated>2024-06-30T20:45:00.486Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of data management, Snowflake has established itself as a powerful player, known for its scalability and flexibility. However, one of the primary concerns for many users is managing costs, with compute resources being a significant factor.</p><h4>Understanding Snowflake Costs</h4><p>The compute resources, or “warehouses,” in Snowflake are responsible for the majority of costs. Each warehouse is essentially a virtual cluster that handles the computational tasks for your queries. As such, the size and configuration of these warehouses directly impact your overall expenses.</p><h4>Optimize Warehouse Size</h4><p>The first and most effective step in reducing Snowflake costs is optimizing the size of your warehouses. Here’s why this matters:</p><ol><li><strong>Cost Impact</strong>: Larger warehouses consume more credits per hour, which can quickly add up, especially in environments with high query loads.</li><li><strong>Performance Balance</strong>: While larger warehouses can offer better performance for complex queries, they may not always be necessary for smaller or less demanding workloads.</li></ol><h4>Best Practices for Optimization</h4><ul><li><strong>Right-Sizing</strong>: Assess your workload requirements and choose a warehouse size that balances cost and performance. This may involve experimenting with different sizes to find the most efficient configuration.</li><li><strong>Scaling</strong>: Take advantage of Snowflake’s ability to scale up or down based on demand. Use auto-suspend and auto-resume features to minimize costs during low-usage periods.</li><li><strong>Monitoring</strong>: Regularly review your usage patterns and adjust warehouse sizes as necessary. Snowflake provides detailed usage reports that can help you identify optimization opportunities.</li></ul><p>By focusing on the size and configuration of your Snowflake warehouses, you can significantly reduce costs while maintaining the performance levels needed for your business operations. Remember, the key is to balance cost efficiency with the performance demands of your data environment.</p><h3><strong>Right-Sizing</strong></h3><p>Identifying the right warehouse size in Snowflake based on historical workloads can be challenging. While there’s no straightforward method, a practical approach involves analyzing query types by the amount of data read by using the following query.</p><pre>with credits as (<br>    select wmh.warehouse_name <br>    ,      sum(credits_used) as credits_used<br>    from snowflake.account_usage.warehouse_metering_history wmh <br>    where wmh.start_time &gt; dateadd(month, -1, current_date())<br>    group by wmh.warehouse_name<br>), queries as ( <br>       SELECT -- Queries over 1Gb in size<br>              qu.warehouse_name ,<br>              warehouse_size , avg(query_load_percent)  as query_load_percent,<br>              AVG(CASE WHEN bytes_scanned   &gt;= 1000000000  THEN bytes_scanned ELSE NULL END) AS avg_large ,<br>              COUNT(CASE WHEN bytes_scanned &gt;= 1000000000  THEN 1 ELSE NULL END) AS count_large ,<br>              COUNT(CASE WHEN bytes_scanned &lt;  1000000000  THEN 1 ELSE NULL END) AS count_small ,<br>              AVG(CASE WHEN bytes_scanned   &gt;= 1000000000  THEN total_elapsed_time / 1000 ELSE NULL END) AS avg_large_exe_time ,<br>              AVG(bytes_scanned) AS avg_bytes_scanned ,<br>              AVG(total_elapsed_time)/ 1000 AS avg_elapsed_time ,<br>              AVG(execution_time)/ 1000 AS avg_execution_time ,<br>              COUNT(*) AS count_queries<br>       FROM<br>              snowflake.account_usage.query_history qu<br>       WHERE<br>              execution_status = &#39;SUCCESS&#39;<br>              AND warehouse_size IS NOT NULL<br>              AND end_time &gt; dateadd(MONTH,-1,CURRENT_DATE())<br>              and bytes_scanned &gt; 0<br>    GROUP BY<br>        qu.warehouse_name,<br>        warehouse_size<br>)<br>SELECT<br>       q.warehouse_name , -- Warehouse Name<br>       q.warehouse_size ,q.query_load_percent,<br>       ROUND(count_large / count_queries * 100, 0) AS percent_large ,<br>       ROUND(count_small / count_queries * 100, 0) AS percent_small ,<br>       CASE<br>              WHEN avg_large &gt;= POWER(2, 40) THEN to_char(ROUND(avg_large / POWER(2, 40), 1)) || &#39; TB&#39;<br>              WHEN avg_large &gt;= POWER(2, 30) THEN to_char(ROUND(avg_large / POWER(2, 30), 1)) || &#39; GB&#39;<br>              WHEN avg_large &gt;= POWER(2, 20) THEN to_char(ROUND(avg_large / POWER(2, 20), 1)) || &#39; MB&#39;<br>              WHEN avg_large &gt;= POWER(2, 10) THEN to_char(ROUND(avg_large / POWER(2, 10), 1)) || &#39; K&#39;<br>              ELSE to_char(avg_large)<br>       END AS avg_bytes_large ,<br>       ROUND(avg_large_exe_time) AS avg_large_exe_time ,<br>       ROUND(avg_execution_time) AS avg_all_exe_time ,<br>       count_queries,<br>    ROUND(c.credits_used) as credits_used<br>FROM queries q,<br>     credits c<br>WHERE q.warehouse_name = c.warehouse_name<br>ORDER BY<br>    c.credits_used desc, q.query_load_percent,<br>    case warehouse_size<br>       when &#39;X-Small&#39; then 1<br>       when &#39;Small&#39;   then 2<br>       when &#39;Medium&#39;  then 3<br>       when &#39;Large&#39;   then 4<br>       when &#39;X-Large&#39; then 5<br>       when &#39;2X-Large&#39; then 6<br>       when &#39;3X-Large&#39; then 7<br>       when &#39;4X-Large&#39; then 8<br>       else 9<br>       end desc;</pre><h4>Query Types: Large vs. Small</h4><p>By categorizing queries as “large” or “small” based on the data volume, we can gain valuable insights. Although this method doesn’t account for query complexity, it generally succeeds in distinguishing between large and small queries effectively.</p><h4>Practical Application</h4><p>To utilize this approach, focus on metrics like percent_large and avg_bytes_large. These indicators provide a basis for determining the appropriate warehouse size that balances cost and performance.</p><p>By leveraging these metrics, you can make informed decisions about scaling your Snowflake warehouses to meet your specific workload demands while optimizing costs.</p><h4>Setting Statement Timeout</h4><p>The default value for STATEMENT_TIMEOUT_IN_SECONDS in Snowflake is set to 48 hours. In practice, this can lead to situations where a poorly constructed query runs for the entire duration, consuming valuable resources and impacting overall performance.To enhance the performance of your Snowflake warehouse, it’s crucial to manage query run times effectively. One practical step is identifying the maximum running time for both successful and failed queries.</p><p><strong>Identifying Longest Running Queries</strong></p><p>By using the following query, you can determine the longest-running query on your warehouse. This data is invaluable for setting the STATEMENT_TIMEOUT_IN_SECONDS parameter, ensuring that your system runs efficiently without unnecessary delays.</p><pre>Success query:<br>select warehouse_name,max(datediff(minute, start_time, end_time)) diff_minutes from query_history<br>where execution_status=&#39;SUCCESS&#39;<br>and start_time &gt; dateadd(MONTH,-1,CURRENT_DATE())<br>and datediff(minute, start_time, end_time)&gt;60<br>group by warehouse_name<br><br>Failure query:<br>select warehouse_name,max(datediff(minute, start_time, end_time)) diff_minutes from query_history<br>where execution_status&lt;&gt;&#39;SUCCESS&#39;<br>and start_time &gt; dateadd(MONTH,-1,CURRENT_DATE())<br>and datediff(minute, start_time, end_time)&gt;60<br>group by warehouse_name<br></pre><ol><li><strong>Run Analysis</strong>: Utilize the provided queries to extract the maximum running times.</li><li><strong>Set Timeout</strong>: Use the longest running time for success query as a benchmark and add a buffer to configure the STATEMENT_TIMEOUT_IN_SECONDS setting on your warehouse.</li></ol><h4>The Impact of Warehouse Start and Stop Cycles</h4><p>In Snowflake, customers are charged for at least 60 seconds each time a warehouse is started, regardless of the query length. Additionally, costs may increase based on the AUTO_SUSPEND time setting.</p><p><strong>Understanding the Cost Implications</strong></p><p>If you frequently start and stop a warehouse for small queries, this can lead to unnecessary wastage. Each cycle incurs charges that, over time, significantly impact overall costs.</p><p><strong>Optimizing Usage</strong></p><p>To minimize expenses, it’s essential to manage the frequency of warehouse start and stop cycles effectively. Consider adjusting your AUTO_SUSPEND settings and grouping queries where possible to maximize efficiency and reduce costs.</p><p>By being mindful of these factors, you can optimize your Snowflake usage, preventing cost overruns while maintaining performance.</p><p>The following query helps to identify warehouse utilization.</p><pre>SHOW WAREHOUSES;<br><br>CREATE OR REPLACE TABLE WAREHOUSE_LIST AS SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));<br><br>create OR REPLACE table warehouse_running_hours as<br>SELECT<br>    wm.WAREHOUSE_NAME,ws.WAREHOUSE_SIZE,<br>    SUM(wm.CREDITS_USED) AS TOTAL_CREDITS_USED,<br>    CASE<br>        WHEN ws.WAREHOUSE_SIZE = &#39;X-Small&#39; THEN SUM(wm.CREDITS_USED) / 1<br>        WHEN ws.WAREHOUSE_SIZE = &#39;Small&#39; THEN SUM(wm.CREDITS_USED) / 2<br>        WHEN ws.WAREHOUSE_SIZE = &#39;Medium&#39; THEN SUM(wm.CREDITS_USED) / 4<br>        WHEN ws.WAREHOUSE_SIZE = &#39;Large&#39; THEN SUM(wm.CREDITS_USED) / 8<br>        WHEN ws.WAREHOUSE_SIZE = &#39;X-Large&#39; THEN SUM(wm.CREDITS_USED) / 16<br>        WHEN ws.WAREHOUSE_SIZE = &#39;2X-Large&#39; THEN SUM(wm.CREDITS_USED) / 32<br>        WHEN ws.WAREHOUSE_SIZE = &#39;3X-Large&#39; THEN SUM(wm.CREDITS_USED) / 64<br>        WHEN ws.WAREHOUSE_SIZE = &#39;4X-Large&#39; THEN SUM(wm.CREDITS_USED) / 128<br>        ELSE NULL<br>    END AS TOTAL_RUNNING_TIME_HOURS<br>FROM<br>    SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY wm<br>JOIN<br>    (SELECT<br>        &quot;name&quot; AS WAREHOUSE_NAME,<br>        &quot;size&quot; AS WAREHOUSE_SIZE<br>    FROM<br>        WAREHOUSE_LIST ) ws<br>    ON wm.WAREHOUSE_NAME = ws.WAREHOUSE_NAME<br>WHERE<br>    wm.START_TIME &gt;= DATEADD(MONTH, -1, CURRENT_DATE)<br>    AND wm.START_TIME &lt; CURRENT_DATE<br>GROUP BY<br>    wm.WAREHOUSE_NAME, ws.WAREHOUSE_SIZE<br>ORDER BY<br>    wm.WAREHOUSE_NAME,ws.WAREHOUSE_SIZE;<br>   <br>create OR REPLACE table query_execution_hours as<br>SELECT<br>    WAREHOUSE_NAME,COUNT(*) QUERY_COUNT,<br>    SUM(EXECUTION_TIME) / 1000 / 60 AS SUM_EXECUTION_TIME_MINUTES,avg(EXECUTION_TIME) / 1000  AS AVG_EXECUTION_TIME_SECONDS,avg(bytes_scanned)/1024/1024 AVG_BYTES_IN_MB  ,SUM(bytes_scanned)/1024/1024/1024 SUM_BYTES_IN_GB<br>FROM<br>    SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY<br>WHERE<br>    START_TIME &gt;= DATEADD(MONTH, -1, CURRENT_DATE)<br>    AND START_TIME &lt; CURRENT_DATE<br>GROUP BY<br>    WAREHOUSE_NAME<br>ORDER BY<br>    WAREHOUSE_NAME;<br><br>    SELECT WH.WAREHOUSE_NAME,wH.WAREHOUSE_SIZE,TOTAL_CREDITS_USED,QUERY_COUNT,(TOTAL_RUNNING_TIME_HOURS*60) TOTAL_RUNNING_TIME_MINUTES , SUM_EXECUTION_TIME_MINUTES,AVG_EXECUTION_TIME_SECONDS,CASE WHEN TOTAL_RUNNING_TIME_HOURS&lt;&gt;0 THEN SUM_EXECUTION_TIME_MINUTES/(TOTAL_RUNNING_TIME_HOURS*60) ELSE 0 END UTILIZATION_FACTOR,<br>    AVG_EXECUTION_TIME_SECONDS,AVG_BYTES_IN_MB,SUM_BYTES_IN_GB<br><br>    FROM warehouse_running_hours WH LEFT OUTER JOIN  query_execution_hours Q<br>    ON WH.WAREHOUSE_NAME=Q.WAREHOUSE_NAME<br>    ORDER BY TOTAL_CREDITS_USED DESC ,UTILIZATION_FACTOR ASC;</pre><p>Use UTILIZATION_FACTOR to identify warehouses with low usage. Improve efficiency by consolidating warehouses or reducing the AUTO_SUSPEND time.</p><h3><strong>Scaling policy</strong></h3><p>For complex queries, consider using scale-up to increase compute power. For handling multiple concurrent queries, scale-out is the best approach. You can also enable ENABLE_QUERY_ACCELERATION =TRUE and set the correct QUERY_ACCELERATION_MAX_SCALE_FACTOR if you only need bigger warehouse size for a very small set of queries</p><p><strong>Balancing Performance and Cost:</strong></p><p>If you’re comfortable with some additional queuing time, setting the SCALING_POLICY to ECONOMY can further optimize costs. This setting allows for more efficient resource allocation while keeping expenses in check.</p><p>By implementing these strategies, you can maintain a balance between performance needs and cost optimization, ensuring your Snowflake environment runs smoothly and economically.</p><h3><strong>Monitoring</strong></h3><p>Implement resource monitors on warehouses to track the warehouse usage over time and track anomalies. You can use the following query to track warehouses without resource monitors.</p><pre>SHOW WAREHOUSES;<br>SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))<br>WHERE &quot;resource_monitor&quot; = &#39;null&#39;;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27b3063b6261" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake SQL best practices]]></title>
            <link>https://medium.com/@vuppala.venkat/snowflake-sql-best-practices-6fd7573bd39d?source=rss-40f1b9d0f236------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd7573bd39d</guid>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Vuppala Venkat]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 02:54:55 GMT</pubDate>
            <atom:updated>2024-03-19T02:54:55.122Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Snowflake order of Optimization:</strong></h3><p>When tuning SQL queries, prioritize optimizations in the following order: row-level operations, followed by group-level operations, analytic functions, and finally, result generation. Tuning the left side of the flow will yield greater impact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2u49QReDYQQF3dFR8ShZg.png" /></figure><h3><strong>Best practices:</strong></h3><ul><li>Utilize the ‘explain’ function to understand Snowflake’s query execution strategy. Data retrieval options include tabular format or JSON.</li><li>Avoid using SELECT * without a LIMIT clause for exploration queries about table data.</li><li>Opt for selecting only the necessary columns rather than using “SELECT *”.</li><li>When using Sliding Window functions, avoid querying large volumes of data.</li><li>Avoid using Complex Functions and UDFs in WHERE Clauses, as they can impact performance.Built-in functions and UDFs are useful but can impact performance when used in query predicates.</li><li>Equality filter performs best because it looks for an exact match.</li><li>Wildcard at the end of a string works better compared to a wildcard at the start of the string.</li><li>Avoid using ORDER BY clauses in CTEs or Subqueries as they waste resources.</li><li>Understand the relationships between your tables’ data before joining. Ensure keys are distinct (deduplicate) on joins to avoid Join Explosion and Cartesian Joins.</li><li>Steer clear of Disjunctive Joins, where a query involves an OR clause for multiple join paths between two data objects (e.g., T1.COL1=T2.COL1 OR T1.COL1=T2.COL2). Instead, rectify this by crafting two separate queries that are subsequently combined using UNION</li><li>Ensure that when joining two tables on a related column, the columns should possess identical data types. If one column has a numeric data type while the other is character, a data type translation issue may arise, leading to an unresolved join and continual resource consumption</li><li>Use the QUALIFY clause in a SELECT statement to filter results of window functions, similar to how HAVING does with aggregate functions and GROUP BY clauses. QUALIFY is recommended for getting the most recent record based on key value.</li><li>If you have a complex query with a large volume of data, materialize the intermediate result using a temporary table .It will help in most cases.</li><li>Design CTEs and Subqueries to use caches to reduce performance issues, keeping in mind how the Result and Data Caches work.</li><li>If an identical subquery exists within a transaction, leverage CTE for reuse.</li><li>ORDER BY is an expensive operation. Use ORDER BY with LIMIT clause when looking for TOP N rows and validate through Explain.</li><li>Query has group by columns with small number of distinct values is less memory intensive .Query has group by columns with a large number of distinct values and is more memory intensive. Try to reduce the distinct groups if possible</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fd7573bd39d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake cost optimization strategies]]></title>
            <link>https://medium.com/@vuppala.venkat/snowflake-cost-optimization-strategies-221e14b1bec0?source=rss-40f1b9d0f236------2</link>
            <guid isPermaLink="false">https://medium.com/p/221e14b1bec0</guid>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Vuppala Venkat]]></dc:creator>
            <pubDate>Sat, 27 Jan 2024 04:10:59 GMT</pubDate>
            <atom:updated>2024-01-27T04:10:59.592Z</atom:updated>
            <content:encoded><![CDATA[<p>The overall cost associated with employing Snowflake includes expenses related to data transfer, storage, and compute resources.</p><p><strong>Compute Resources:</strong></p><p>Within Snowflake, the use of compute resources incurs costs in Snowflake credits. The billed amount for compute resources is calculated by multiplying the consumed credits by the credit price, dependent on the Snowflake edition, region, and cloud platform.</p><p>There are three types of compute resources in Snowflake that consume credits:</p><ul><li><strong>Virtual Warehouse Compute: </strong>These user-managed compute resources use credits during data loading, query execution, and other DML operations. Virtual warehouses are billed for the credits they actively consume.</li><li><strong>Serverless Compute: </strong>Features like Search Optimization and Snowpipe use Snowflake-managed compute resources. These resources are automatically resized by Snowflake to match workload requirements, minimizing costs.</li><li><strong>Cloud Services Compute: </strong>This layer of the Snowflake architecture consumes credits for behind-the-scenes tasks. Charges apply only if daily consumption exceeds 10% of the daily warehouse usage.</li></ul><p><strong>Storage Resources:</strong></p><p>The monthly cost of storing data in Snowflake is based on a flat rate per terabyte (TB). Storage expenses are calculated monthly, considering the average number of on-disk bytes stored each day.</p><p><strong>Data Transfer Resources:</strong></p><p>While Snowflake doesn’t impose data ingress fees, it charges for data egress. A per-byte fee is applied when transferring data between regions on the same cloud platform or across different cloud platforms.</p><p><strong>Optimizing Compute Costs:</strong></p><p>Compute resources constitute the majority of the Snowflake bill. Several strategies can be employed to save on compute costs:</p><ul><li><strong>Right-sizing the Warehouse</strong>: Optimizing the warehouse size is crucial as it significantly influences compute costs. In scenarios requiring high concurrency, consider employing a multi-cluster warehouse. I suggest initiating with a smaller X-small warehouse and gradually scaling up one size at a time, especially if queries frequently write data to local/cloud storage.</li><li><strong>Auto-suspend Warehouse</strong>: <br>It is advisable to activate auto-suspend for all warehouses. However, it’s essential to note that suspending a warehouse clears the data cache. If you run similar queries consistently for extended periods, you may want to contemplate utilizing tasks to manually start and suspend warehouses when needed, instead of relying solely on auto-suspend. Evaluate both options and make a decision based on your specific requirements.</li><li><strong>Reduce Auto-suspend Time:</strong>Reducing the auto-suspend duration could potentially result in decreased data caching. Adjust the timeout setting and closely monitor its effects on cost, cache, and overall performance.</li><li><strong>Query time-out:</strong>The default query timeout is set to 48 hours. In case of a poorly structured, long-running query, it persists for the entire 48-hour duration before termination. Adjust the STATEMENT_TIMEOUT_IN_SECONDS for the warehouse according to its workload. If the lengthiest successful query in the pipeline takes 3 hours, consider setting STATEMENT_TIMEOUT_IN_SECONDS to 4 or 5 hours to provide additional buffer for concurrent queries.</li><li><strong>Monitor and Tune Queries</strong>: Regularly monitor the longest successful queries and tune them using best practices.</li><li><strong>Monitor time-out and failed queries</strong>: Closely monitor queries that have failed due to timeouts. The provided query will generate a list of failed queries that ran for over 30 minutes within the past 30 days. Review these queries and, if necessary, provide users with training on best practices for Snowflake SQL</li></ul><blockquote>select a.*,(datediff(minute, start_time, end_time)) diff_minutes from query_history a where execution_status&lt;&gt;’SUCCESS’ and start_time &gt; dateadd(MONTH,-30,CURRENT_DATE())</blockquote><blockquote>and datediff(minute, start_time, end_time)&gt;30</blockquote><blockquote>and error_code=’000630&#39;</blockquote><blockquote>order by (datediff(minute, start_time, end_time)) desc</blockquote><ul><li><strong>Use Resource Monitors</strong>: Implement resource monitors on warehouses and accounts for oversight.</li></ul><p><strong>Optimizing Storage Resources:</strong></p><p>Storage costs make up a smaller portion of the Snowflake bill. To save on storage expenses:</p><ul><li><strong>Adjust Time Travel Settings</strong>: The DATA_RETENTION_TIME_IN_DAYS parameter impacts storage costs. Adjust this parameter based on business requirements, considering the trade-off with time travel rollback ability.</li><li><strong>Utilize Cloning</strong>: Cloning can be employed to copy tables, schemas, databases, and other objects efficiently.</li></ul><p><strong>Optimizing Pipelines Costs:</strong></p><p>To minimize pipeline costs, consider the following strategies:</p><ul><li><strong>Load Delta Data</strong>: Prefer loading delta data to the target table over truncate and load. This approach can save costs on both compute and storage.</li><li><strong>Use Transient Tables</strong>: For large intermediate tables, use transient or temporary tables if extended time travel is not required.</li><li><strong>Optimal File Sizes:</strong> Execute copy commands on optimally sized files (100–250 MB) for efficiency, as opposed to single large files or too many tiny files (1 KB).</li><li><strong>Data Sharing:</strong> Leverage data sharing to share data between accounts in the same cloud provider and region</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=221e14b1bec0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Data Consistency: Achieving Matching Hash Values in Snowflake and SQL Server]]></title>
            <link>https://medium.com/@vuppala.venkat/unlocking-data-consistency-achieving-matching-hash-values-in-snowflake-and-sql-server-ac163183fe7b?source=rss-40f1b9d0f236------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac163183fe7b</guid>
            <dc:creator><![CDATA[Vuppala Venkat]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 21:46:15 GMT</pubDate>
            <atom:updated>2023-06-29T13:24:15.815Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of data management, maintaining data integrity is paramount. One essential function in SQL Server that helps achieve this is the ‘hashbytes’ function. This function enables the identification of hashing algorithms used to hash input data</p><p>To ensure consistency during the migration of data from SQL Server to Snowflake, you can utilize the sha2 function in Snowflake as an equivalent to the hashbytes function. It’s worth noting that these functions generate different results. To achieve uniformity, you can employ the following function in Snowflake.</p><p>Snowflake function:</p><p>select ‘0x’||upper(sha2(collate(‘Text that need to hashed’, ‘WINDOWS1252’),256))</p><p>SQL Server hash bytes function:</p><p>select HASHBYTES(‘SHA2_256’,cast(‘Text that need to hashed’ as NVARCHAR(255)))</p><p>“The ‘0x’ prefix simply indicates a hexadecimal value. If you do not require the ‘0x’ prefix, feel free to remove it from the concatenation. The encoding ‘WINDOWS1252’ signifies the widely used character encoding in SQL Server. If you are utilizing a different character encoding, please make use of the corresponding value</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac163183fe7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>