title: BigQuery takes too long to load data from Android
body: <p>BigQuery query call takes too long to load data. It takes around 7-8 seconds to get the result the same result takes 1 second on BigQuery Google Cloud Platform.</p>
  
  <p>I have tried the same as per the document for google cloud BigQuery library.
  <a href="https://cloud.google.com/bigquery/docs/quickstarts/quickstart-client-libraries" rel="nofollow noreferrer">https://cloud.google.com/bigquery/docs/quickstarts/quickstart-client-libraries</a></p>
  
  <pre><code>InputStream is = 
  mContext.getAssets().open("service_account.json");
  BigQuery bigquery = BigQueryOptions.newBuilder()
  .setProjectId("uniorder-prod")
  .setCredentials(ServiceAccountCredentials.fromStream(is))
  .build().getService();
  
  QueryJobConfiguration queryConfig = 
  QueryJobConfiguration.newBuilder("standard sql query")
  .setUseLegacySql(false)
  .build();
  
  JobId jobId = JobId.of(UUID.randomUUID().toString());
  Job queryJob = bigquery
                      .create(JobInfo
                              .newBuilder(queryConfig)
                              .setJobId(jobId).build());
  queryJob = queryJob.waitFor();
  
  if (queryJob == null) {
  throw new RuntimeException("Job no longer exists");
  } else if (queryJob.getStatus().getError() != null) {
  throw new 
  RuntimeException(queryJob.getStatus().getError().toString());
  }
  
  QueryResponse response = bigquery.getQueryResults(jobId);
  TableResult result = queryJob.getQueryResults();
  
  //Current query execution time is 7-8 second
  //Expected query execution time is 1 or less than 1 second
  
  //My SQL BigQuery
  SELECT
    EXTRACT(DATE
    FROM
      TIMESTAMP(param2.value.string_value)) AS date,
    SUM(param3.value.double_value) AS total_price
  FROM
    `uniorder-prod.analytics_200255431.events_*`,
    UNNEST(event_params) AS param1,
    UNNEST(event_params) AS param2,
    UNNEST(event_params) AS param3
  WHERE
    event_name = "total_consumption_res"
    AND param1.key = "user_id"
    AND param1.value.int_value = 118
    AND param2.key = "timestamp"
    AND param3.key = "total_price"
    AND _TABLE_SUFFIX BETWEEN '20190601'
    AND '20190630'
  GROUP BY
    date
  ORDER BY
    date ASC
  </code></pre>