How to avoid order by in Look SQL?

  • 12 July 2018
  • 4 replies

Userlevel 2

I am using Looker with Google BigQuery and sometime reports are slow or throws resource exceed error due to order by clause. I also see post in discourse that suggests not to use order by for Google BigQuery SQLs but looker by default have order by clause and not able to find option to have order by optional to improve performance.

4 replies

Userlevel 4

Hi @kshah7,

Currently, the option to remove table sorting in Looker is only for downloads. You’ll see the checkbox in the download modal. All other queries will have an ORDER BY clause in SQL.

If you’d like to tell me a little more about your use case, I’d be happy to pass your feedback on to our product team!



Hi, I’m having the same issue, if I could remove completely the order by clause from the SQL and sort the results afterwards it could make it run faster.

Since this answer from 2 years ago is the most recent answer I found about his topic, I’d like to know if looker team have something new on this now.

Userlevel 7

I have not tested this, nor do I know if it’s an acceptable UX, but I am wondering if you could make a “Sort Prevention” measure, whose sql is just NULL or some other constant, and sort by that. Maybe your database would optimize that as no sorting?

Hi! I want to revive this thread. I’m also having this issue as we are using AWS Redshift database behind Looker and ORDER BY’s don’t play nice with it, as they need to be executed in the S3 layer and then return the result to Redshift. It would be cool to have the ability to disable the order by in queries, since the user can order the results on the interface with affecting the performance of the database.