<?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 Ideal number and size of partitions in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/ideal-number-and-size-of-partitions/m-p/25502#M17742</link>
    <description>&lt;P&gt;Spark by default uses 200 partitions when doing transformations. The 200 partitions might be too large if a user is working with small data, hence it can slow down the query. Conversely, the 200 partitions might be too small if the data is big. So how do I figure out what the ideal partition size should be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideal partition size is expected to be 128 MB to 1 GB. How do I go about making sure that partition size falls in this category?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jun 2021 02:26:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-06-09T02:26:50Z</dc:date>
    <item>
      <title>Ideal number and size of partitions</title>
      <link>https://community.databricks.com/t5/data-engineering/ideal-number-and-size-of-partitions/m-p/25502#M17742</link>
      <description>&lt;P&gt;Spark by default uses 200 partitions when doing transformations. The 200 partitions might be too large if a user is working with small data, hence it can slow down the query. Conversely, the 200 partitions might be too small if the data is big. So how do I figure out what the ideal partition size should be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideal partition size is expected to be 128 MB to 1 GB. How do I go about making sure that partition size falls in this category?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 02:26:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/ideal-number-and-size-of-partitions/m-p/25502#M17742</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-09T02:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ideal number and size of partitions</title>
      <link>https://community.databricks.com/t5/data-engineering/ideal-number-and-size-of-partitions/m-p/25503#M17743</link>
      <description>&lt;P&gt;You could tweak the default value 200 by changing spark.sql.shuffle.partitions configuration to match your data volume. Here is a &lt;A href="https://github.com/justinbreese/databricks-gems/blob/master/shufflePartitionCalculator/sparkShufflePartitionCalculator.py" alt="https://github.com/justinbreese/databricks-gems/blob/master/shufflePartitionCalculator/sparkShufflePartitionCalculator.py" target="_blank"&gt;sample python code&lt;/A&gt; for calculating the value&lt;/P&gt;&lt;P&gt;However if you have multiple workloads with different data volumes, instead of manually specifying the configuration for each of these, it is worth looking at AQE &amp;amp; Auto-Optimized Shuffle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/spark/latest/spark-sql/aqe.html" alt="https://docs.databricks.com/spark/latest/spark-sql/aqe.html" target="_blank"&gt;AQE adjusts the shufzfle partition number&lt;/A&gt; automatically at each stage of the query, based on the size of the map-side shuffle output. So as data size grows or shrinks over different stages, the task size will remain roughly the same, neither too big nor too small. However, AQE does not change the initial partition number by default - so if you are seeing spilling in your jobs you could enable auto optimized shuffle by setting &amp;lt;db_prefix&amp;gt;.autoOptimizeShuffle.enabled to true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More details at &lt;/P&gt;&lt;P&gt;&lt;A href="https://databricks.com/blog/2020/10/21/faster-sql-adaptive-query-execution-in-databricks.html" alt="https://databricks.com/blog/2020/10/21/faster-sql-adaptive-query-execution-in-databricks.html" target="_blank"&gt;https://databricks.com/blog/2020/10/21/faster-sql-adaptive-query-execution-in-databricks.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 10:35:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/ideal-number-and-size-of-partitions/m-p/25503#M17743</guid>
      <dc:creator>sajith_appukutt</dc:creator>
      <dc:date>2021-06-09T10:35:00Z</dc:date>
    </item>
  </channel>
</rss>

