---
schema_version: "1"
id: 3c66f3827bda16e8d47f8477985edb03f90ef9efa649e70928909992f4c62fa6
title: Assuming Referential Integrity for Joins
collection: tableau
version: current
locale: en-us
portal_url: https://docs.salesforce.com/tableau/current/en-us/pro/desktop/joins_assume_refinteg.md
canonical_url: https://help.tableau.com/current/pro/desktop/en-us/joins_assume_refinteg.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 4f71ff676b864553ae9a7c27bac3227e3058b8ecc9eee69992f599ba3589ad13
description: Improve join query performance by assuming referential integrity.
---
[Skip to main content](#main-content)

# Assuming Referential Integrity for Joins

In some cases, you can improve query performance for joins by selecting the option to Assume Referential Integrity from the Data menu. When you use this option, Tableau will include the joined table in the query only if it is specifically referenced by fields in the view.

![Data menu with the option to assume referential integerity highlighted.](/tableau/current/en-us/pro/desktop/en-us/Img/joins_assumerefinteg.png)

Using this setting is appropriate when you know that your data has referential integrity (see definition below) but your database is not enforcing or cannot enforce referential integrity. If you have the option of configuring referential integrity in your database that is a better option than using this setting because it can improve performance both in the database and in Tableau. The Assume Referential Integrity option in Tableau can only affect performance on Tableau's end. If your data does not have referential integrity and you turn on this setting, query results may not be reliable.

To understand what referential integrity is, imagine connecting to sales data that has two tables: Sales and Product Catalog. These two tables are shown below:

<table>
                    <colgroup>
                    </colgroup>
                    <tbody>
                        <tr>
                            <td>
                                <p><b>Sales</b>
                                </p>
                                <table class="table--plain">
                                    <tbody>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Product ID (Foreign Key)</td>
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Sale Amount</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Transaction Date</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td>
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">100</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">10/1/2012</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td>
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2000</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">10/2/2012</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td>
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">50</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">9/30/2012</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyB-Column1-Body1">3</td>
                                            <td class="TableStyle-Basic-Border-BodyB-Column1-Body1">10</td>
                                            <td class="TableStyle-Basic-Border-BodyA-Column1-Body1">8/21/2012</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                            <td>
                                <p><b>Product Catalog</b>
                                </p>
                                <table class="table--plain">
                                    <tbody>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Product ID (Primary Key)</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Product Name</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">10 Inch Tablet</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Smart Phone</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyE-Column1-Body1">3</td>
                                            <td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Desk Lamp</td>
                                        </tr>
                                        <tr class="TableStyle-Basic-Border-Body-Body1">
                                            <td class="TableStyle-Basic-Border-BodyB-Column1-Body1">4</td>
                                            <td class="TableStyle-Basic-Border-BodyA-Column1-Body1">Memory Stick</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>

Because all products that are sold must have a listing in the Product Catalog, every row in the Sales table has a matching row in the Product Catalog table. When these two tables are joined on Product ID, you end up with a table that looks like this:

<table class="table--plain"><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Product ID</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Product Name</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Product ID</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Sale Amount</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Transaction Date</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">10 Inch Tablet</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">100</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">10/1/2012</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">10 Inch Tablet</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2000</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">10/2/2012</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Smart Phone</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">50</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">9/30/2012</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">3</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">Desk Lamp</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">3</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">10</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1">8/21/2012</td></tr></tbody></table>

Now let's say you build a view to look at Sale Amount by Region. By default, dragging the Sale Amount field to the view may create a query like this:

SELECT SUM(\[Sales Amount\]) FROM \[Sales\] S INNER JOIN \[Product Catalog\] P ON S.ProductID = P.ProductID

By selecting Assume Referential Integrity, you tell Tableau that the joined tables have referential integrity. In other words, you are confirming that the Sales table will always have a matching row in the Product Catalog table. Because that is true, Tableau doesn't need any information from the Product Catalog table in order to return these results. When you drag the Sales Amount field into the view, Tableau can simplify the query to:

SELECT SUM(\[Sales Amount\]) FROM \[Sales\]

This simplified query can often return quicker results because it removes the join operation. This option impacts only inner joins and does not affect data sources with a single table.