<?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: My Spark SQL join is very slow - what can I do to speed it up? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30448#M22085</link>
    <description>&lt;P&gt;@Vida Ha​&amp;nbsp; I just did "Run All" on a clone of the "&lt;B&gt;BroadcastHashJoin&lt;/B&gt;" notebook, and it appears to have errors.&lt;/P&gt;&lt;P&gt;On &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%sql ANALYZE TABLE my_small_table COMPUTE STATISTICS noscan&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which appears right after "Configure a BroadcastHashJoin for a small table.", we get org.apache.spark.sql.catalyst.analysis.NoSuchTableException. I'm guessing this is b/c at this point in the notebook (on it's first run), my_small_table has only been created with registerTempTable; not with saveAsTable (which I think is required for ANALYZE). &lt;/P&gt;&lt;P&gt;If I run the code blocks lower down to do the saveAsTable and then come back here and rerun the "ANALYZE" step, I get:&lt;/P&gt;&lt;P&gt;Error in SQL statement: com.databricks.backend.daemon.driver.DriverLocal$SQLExecutionException: java.lang.UnsupportedOperationException: Analyze only works for Hive tables, but my_small_table is a LogicalRelation&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2015 16:40:48 GMT</pubDate>
    <dc:creator>MarcLimotte</dc:creator>
    <dc:date>2015-07-22T16:40:48Z</dc:date>
    <item>
      <title>My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30444#M22081</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;It's taking 10-12 minutes - can I make it faster?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 01:00:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30444#M22081</guid>
      <dc:creator>vida</dc:creator>
      <dc:date>2015-06-18T01:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30445#M22082</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;If one of your tables is very small, you can do a Broadcast Hash Join to speed up your join. There's notebook on the Databricks Guide on that - search for "&lt;B&gt;BroadcastHashJoin&lt;/B&gt;" to find that notebook.&lt;/P&gt;
&lt;P&gt; Otherwise, a join operation in Spark SQL does cause a shuffle of your data to have the data transferred over the network, which can be slow. If you query the joined table multiple times, you may consider:&lt;/P&gt;
&lt;P&gt;1) Saving your joined table as it's own table.&lt;/P&gt;
&lt;P&gt;2) Creating a temporary table that represents the joined table, and then caching that table.&lt;/P&gt;
&lt;P&gt;This will prevent needing to shuffle the data and doing the join multiple times.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 01:17:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30445#M22082</guid>
      <dc:creator>vida</dc:creator>
      <dc:date>2015-06-18T01:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30446#M22083</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I'm making join between Parquet DB stored on S3 &lt;/P&gt;
&lt;P&gt;but it's seems that anyway Spark try to read all the data as we not see better performance when changing the queries.&lt;/P&gt;
&lt;P&gt;I need to continue to investigate this point because it's not yet clear.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jun 2015 07:25:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30446#M22083</guid>
      <dc:creator>richard1_558848</dc:creator>
      <dc:date>2015-06-21T07:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30447#M22084</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I think I'm experiencing something similar.&lt;/P&gt;
&lt;P&gt;Not using S3 yet. But reading Parquet tables into DataFrames, trying tactics like &lt;PRE&gt;&lt;CODE&gt;persist&lt;/CODE&gt;&lt;/PRE&gt;, &lt;PRE&gt;&lt;CODE&gt;coalesce&lt;/CODE&gt;&lt;/PRE&gt;, &lt;PRE&gt;&lt;CODE&gt;repartition&lt;/CODE&gt;&lt;/PRE&gt; after reading from Parquet. Using HiveContext, if that matters. But I get the impression that it's ignoring my attempts to repartition and cache and always recomputing my queries from scratch.&lt;/P&gt;
&lt;P&gt;I'm definitely still new at this, so not sure yet how to figure out what's really going on.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2015 18:52:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30447#M22084</guid>
      <dc:creator>__rake</dc:creator>
      <dc:date>2015-06-25T18:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30448#M22085</link>
      <description>&lt;P&gt;@Vida Ha​&amp;nbsp; I just did "Run All" on a clone of the "&lt;B&gt;BroadcastHashJoin&lt;/B&gt;" notebook, and it appears to have errors.&lt;/P&gt;&lt;P&gt;On &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%sql ANALYZE TABLE my_small_table COMPUTE STATISTICS noscan&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which appears right after "Configure a BroadcastHashJoin for a small table.", we get org.apache.spark.sql.catalyst.analysis.NoSuchTableException. I'm guessing this is b/c at this point in the notebook (on it's first run), my_small_table has only been created with registerTempTable; not with saveAsTable (which I think is required for ANALYZE). &lt;/P&gt;&lt;P&gt;If I run the code blocks lower down to do the saveAsTable and then come back here and rerun the "ANALYZE" step, I get:&lt;/P&gt;&lt;P&gt;Error in SQL statement: com.databricks.backend.daemon.driver.DriverLocal$SQLExecutionException: java.lang.UnsupportedOperationException: Analyze only works for Hive tables, but my_small_table is a LogicalRelation&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 16:40:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30448#M22085</guid>
      <dc:creator>MarcLimotte</dc:creator>
      <dc:date>2015-07-22T16:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30449#M22086</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi mlimotte,&lt;/P&gt;
&lt;P&gt;This notebook ran for an older version of Spark - we will update it for Spark 1.4 in the next Databricks release. In general these tips still hold true:&lt;/P&gt;
&lt;P&gt;1) If you want to figure out if a BroadcastHashJoin is happening or not - use %sql explain select &lt;/P&gt;
&lt;P&gt;2) The analyze command is not needed for all table types now - such as when you create a table with ".saveAsTable"&lt;/P&gt;
&lt;P&gt;-Vida&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 17:57:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30449#M22086</guid>
      <dc:creator>vida</dc:creator>
      <dc:date>2015-07-22T17:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30450#M22087</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi Vida&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;The analyze command is not needed for all table types now - such as when you create a table with ".saveAsTable"&lt;/P&gt;
&lt;P&gt;Does this mean statistics are available for any tables created with .saveAsTable (and hence they would be broadcast if their size is under the broadcast limit ?)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 07:04:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30450#M22087</guid>
      <dc:creator>DeenarToraskar</dc:creator>
      <dc:date>2015-11-18T07:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30451#M22088</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;actually I got my answer from the BroadcastHashJoin workbook. (which is Yes)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 07:06:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30451#M22088</guid>
      <dc:creator>DeenarToraskar</dc:creator>
      <dc:date>2015-11-18T07:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: My Spark SQL join is very slow - what can I do to speed it up?</title>
      <link>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30452#M22089</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Analyze is not needed with parquet tables that use the databricks parquet package. That is the default now when you use .saveAsTable(), but if you use a different output format - it's possible that analyze may not work yet.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 18:00:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/my-spark-sql-join-is-very-slow-what-can-i-do-to-speed-it-up/m-p/30452#M22089</guid>
      <dc:creator>vida</dc:creator>
      <dc:date>2015-11-18T18:00:36Z</dc:date>
    </item>
  </channel>
</rss>

