How to Connect PostgreSQL to Tableau

Galaxy Glossary

How do I connect a PostgreSQL database to Tableau?

Connect Tableau to a PostgreSQL database so you can visualize and analyze data in real time.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

Why connect Tableau to PostgreSQL?

Direct connections let analysts build live dashboards without CSV exports, keeping metrics current and eliminating manual refreshes.

What credentials must I collect?

You need host, port (5432 by default), database name, user, password, and—if enforced—SSL mode and certificate files.

How do I install the PostgreSQL driver?

Download the official driver from Tableau’s site → run the installer → restart Tableau Desktop to load the new connector.

How do I add the connection in Tableau Desktop?

1.Open Tableau Desktop → Data ▸ New Data Source
2. Select PostgreSQL → fill in host, port, database, user, and password.
3. Tick Require SSL if your server enforces it.
4. Click Sign In → choose schema → drag tables to the canvas.

Can I use a custom SQL query?

Yes. Click New Custom SQL, paste your query (e.g., join Orders and Customers), and press OK.

Which connection-string parameters matter?

sslmode sets encryption (prefer, require).application_name tags sessions, helping DBAs trace Tableau traffic.

How do I verify my connection?

Run a quick viz: drag order_date to Columns and total_amount to Rows → confirm values match psql output.

Best practices for secure, fast connections?

Create a read-only role in PostgreSQL, restrict to the analytics schema, and enable connection pooling to avoid session floods.

What are common mistakes?

See the section below—fix credentials typos and ensure the driver version matches Tableau’s requirements.

.

Why How to Connect PostgreSQL to Tableau is important

How to Connect PostgreSQL to Tableau Example Usage


SELECT c.name,
       o.order_date,
       SUM(oi.quantity * p.price) AS customer_spend
FROM   Customers c
JOIN   Orders o      ON o.customer_id = c.id
JOIN   OrderItems oi ON oi.order_id   = o.id
JOIN   Products p    ON p.id          = oi.product_id
WHERE  o.order_date >= CURRENT_DATE - INTERVAL '30 days'
GROUP  BY c.name, o.order_date;

How to Connect PostgreSQL to Tableau Syntax


Connection string (Tableau ▸ Advanced ▸ Initial SQL):

postgresql://<user>:<password>@<host>:<port>/<dbname>?sslmode=require&application_name=tableau

Example for ecommerce data:

postgresql://bi_read:secure@db.prod.internal:5432/store?sslmode=require

Key Parameters:
  user            → role with SELECT on Customers, Orders, Products, OrderItems
  password        → strong secret stored in Tableau credential manager
  host, port      → PostgreSQL server address and port
  dbname          → database that owns the ecommerce tables
  sslmode         → disable | allow | prefer | require (choose require for encryption)
  application_name→ optional tag (helps in pg_stat_activity)

Common Mistakes

Frequently Asked Questions (FAQs)

Does Tableau Server need the same driver?

Yes. Install the identical PostgreSQL driver version on every Tableau Server node to prevent "unsupported driver" errors.

Can I use an SSH tunnel instead of opening port 5432?

Absolutely. Set up a local tunnel (e.g., ssh -L 5433:db.internal:5432) and point Tableau at localhost:5433.

How do extracts differ from live connections?

Extracts snapshot data into Tableau’s Hyper format, improving speed and isolating production DBs, but they require scheduled refreshes.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie
BauHealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.