title: Count on External Table to Azure Data Storage is taking too long
body: <p>I have created an External table to Azure Data Lake Storage Gen2.</p>
  <p>The Container has about 200K Json files.</p>
  <p>The structure of the json files are created with</p>
  <pre><code>CREATE EXTERNAL TABLE IF NOT EXISTS dbo.table(   
      ComponentInfo STRUCT&lt;ComponentHost: STRING, ComponentId: STRING, ComponentName: STRING, ComponentVersion: STRING, SubSystem: STRING&gt;,
      CorrelationId STRING,   
      Event STRUCT&lt;Category: STRING, EventName: STRING, MessageId: STRING, PublishTime: STRING, SubCategory: STRING&gt;,   
      References STRUCT&lt;CorrelationId: STRING&gt;) 
      USING org.apache.spark.sql.json OPTIONS ('multiLine' = 'true') 
      LOCATION 'dbfs:/mnt/mnt'
  </code></pre>
  <p>Counting takes such a long time to run and still at stage 62 with 754 tasks.  Loading top 200 is fine but is there an incorrect setup that needs to be addressed.  Should it be partitioned?</p>
  <pre><code>select count(*) from dbo.table
  </code></pre>