# Unindexed Foreign Keys

Today’s assignment: subscribe to the “Unindexed Foreign Keys” exception report.

Really, that’s the gist of this blog post, but I will elaborate. Number 11 of my post on [Writing Fast Queries](https://apexdebug.com/writing-fast-queries) is that joins (and where clauses) should have indexed columns. Joins *almost always* involve a foreign key (FK). Every FK should have an associated index. Always. Sometimes we miss them, but there is an easy way to find them.

1. Navigate to SQL Workshop &gt; Utilities &gt; Object Reports.
    
2. Under the heading “Exception Reports”, select “Unindexed Foreign Keys”.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733242343191/d957c36f-79fc-4bfa-94b7-f12174e6f460.png align="left")
    
3. If there are any results, create the recommended indexes.
    
4. This is an interactive report…so you can subscribe to it.  
    Enable “Skip if No Data Found” so that you only receive the report if there is an issue.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733242224965/3f752681-c1ab-4c7b-ad3e-01e771a0596b.png align="center")
    

That’s it.

Bonus: There are several other exception reports. You may want to subscribe to some of those as well.
