Max
Max

Reputation: 73

Tableau take forever to use a PostgreSQL view

I am trying to connect Tableau to a SQL view I made in PostgreSQL.

This view returns ~80k rows with 12 fields. On my local PostgreSQL database, it take 7 seconds to execute. But when I try to create a chart in a worksheet using this view, it take forever to display something (more than 2 minutes to add just a field).

This views in complex and involve many join, coalesce and case due to business specifities.

Do you guys have an idea to improve?

Thank you very much for your help ! :-)

Best,

Max

Upvotes: 0

Views: 263

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11921

Tableau documentation has helpful info for performance optimization https://help.tableau.com/current/pro/desktop/en-us/performance_tips.htm

I highly recommend the whitepaper on designing efficient dashboards mentioned on that site - a bit dated, but timeless advice

For starters, learn to use the Performance Recorder in Tableau to find out what tasks are causing delays, and if they involve queries, to capture the SQL that Tableau emits.

With Tableau, and many other client tools, the standard first approach is to see what SQL the client tool generates, then execute that SQL without using the client tool, say just in psql in your case. If you can reproduce the slow query just in SQL, then you are better positioned to either

  1. Optimize your database, say either with indices, or restructuring your schema OR
  2. Understand why your client tool, Tableau in this case, generated that inefficient query and reason about what you could differently in Tableau that would cause it to generate different SQL

The whitepaper I mentioned should be helpful

Upvotes: 1

Related Questions