I do not think there is a limit on the code length of a custom SQL. Other limitations may depend on the underlying database too. Also you may want to consider having View / Materialized View in the database instead of custom SQL.
6000-7000 rows of SQL is a lot. I'd make a couple of suggestions:
1) Do some additional data prep to get the data into the format you need.
2) As Vivek Nayagam noted, create the SQL as a view in the database.
3) Create a stored procedure which returns the data you need.
1 of 1 people found this helpful
As some of the folks suggested ,
I would rather create an Oracle View /or Even Materialised View for z data fetching queries
Custom SQL has another disadvantage of being in a sub-query internally which can cause performance issues.
The biggest drawback to using custom SQL as a connection is that it becomes a sub-select to every query Tableau runs against every Tableau view.
Please mark any of the relevant answer as CORRECT & HELPFUL if it really helped you so that it can help others.
Following up --->Please mark the answer as CORRECT & HELPFUL if it really helped you so that it can help others.
I am satisfied with the processing time of my query. The Custom SQL query editor starts to work slowly when I edited with the long SQL code. I proposed there may be reason in the code length. If the editor has limitations on the length of the SQL code. Dear colleagues, did you have any experience writing a long query in the Tableau custom SQL query?
When you say Custom Query is throwing an error then there can be doubts on the length of the query (given that it is throwing an error saying
maximum limit exceeded )
I am sure that Tableau would be smart enough to let you know that you have exceeded the maximum limit but if it is accepting your query and even running in the background (then it is accepting the code length )
Now ,there can be different factors to the slowness of your queries.
Why don't you try Performance recording and drill down to the slowness ?Record and Analyze Workbook Performance
What about running this query directly at DB ? How much is the time difference ?
When you are shortening the code I suppose you are creating a better optimised code which is making your query run faster
Select * from TABLE ;
Select * from TABLE where USER_ID=1 ;
I have INDEX on USER_ID and the second query will run much faster then the first although it is a LONGER CODE
I don't think Length is the factor , the concerned factor is the 'THE OPTIMISED CODE ' , but yes , most of the time longer the code , more the sub-queries inside etc will lead to performance issues.
I'm satisfied with the finally speed of the long query itself . The editing of the code in the long query is slow. Is the reason for this that the query is hashed when writing in the editor?
The SQL editor for custom SQL in Tableau isn't really meant for editing. My suggestion would be to use an editor built for your database or another platform-independent tool to write your SQL. Then just copy and paste it into the custom SQL in Tableau.