Maximum Character/Row Limit for the actual SQL Code in SQL Runner?

  • 16 March 2018
  • 4 replies

Userlevel 1

Hi All,

I’ve scoured Looker Discourse for the answer to my question, but it doesn’t appear that this question has been asked yet:

  • Does looker SQL Runner have a limit to how many rows or characters a query can be? Not the limit in the results (which I know is 5,000 rows max), but rather a limit of rows/characters for an SQL query?

I have a piece of code that is approx. 670 rows (about 74K characters with spaces) - mostly due to syntax of how I typically write SQL.

Syntax example (this is just easier for me to read in case I need to revisit this code months in the future):

select a

, b

, c

, d

, z

from TABLE

  • With this piece of code, I get an error that states that the SQL came to an unexpected end:

However, if I condense the select all in the bottom code that references the master_aggregated table, to the following; the query runs perfectly fine:

If you look at both screen shots, the only literal differences between the two is that the select all at the bottom has been reduced to 1 line instead of 3 and the “from” and “join” conditions above the select all has been reduced to 1 line instead of 4.

Not entirely sure if this is a Google Bigquery issue or a Looker issue (or both), but any advice or insight would be appreciated.


4 replies

Userlevel 2

Hey @JLiou,

There is a character limit of 65,535 characters in SQL Runner where whitespace does count toward the character limit. This is why condensing lines of code allows the query to run as it lowers the character count.

Userlevel 1

Thank you for the quick information. Is there any official documentation on that? Any more SQL documentation for Looker SQL would be appreciated.

Also, are there any work arounds for this other than rewriting part of it in LookerML?


Userlevel 2

Hey @JLiou,

I can definitely let the our docs team know you’d like to see this character limited documented! Our docs on SQL Runner can be found here.

I can definitely let the team know you’d like to have this limit increased. In the meantime, as a workaround, I recommend combining as many lines of code as possible.

Thanks everyone! This information has been added to the Looker documentation on this page.