title: Performance consideration while converting hql script to spark
body: <p>I have a SQL script which has below SQL commands.</p>
  <pre><code>drop table table_1;
  
  Create table table_1 stored as orc as 
  (select * from table_2 
  union all
  select * from table_3)
  </code></pre>
  <p>I am trying to convert this into pyspark.</p>
  <p>I know two ways of doing this.</p>
  <ol>
  <li><p>Directly give the SQL statement into spark SQL like below.</p>
  <p>spark.sql(&quot;drop table table_1&quot;)
  spark.sql(&quot;Create table table_1 stored as orc as
  (select * from table_2
  union all
  select * from table_3))</p>
  </li>
  <li><p>Create a temp view based on select statement(CreateorReplacetempview). And then create table with schema and then insert into table from tempview.</p>
  </li>
  </ol>
  <p>The table has approximately 1 billion rows.
  From a performance perspective, which method would be better? Method 1 or method 2? Or if there is any other better recommendation, please feel free to suggest.</p>