Skip to main content

Command Palette

Search for a command to run...

Unindexed Foreign Keys

Oracle APEX > SQL Workshop > Utilities > Exception Reports

Updated
1 min read
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 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 > Utilities > Object Reports.

  2. Under the heading “Exception Reports”, select “Unindexed Foreign Keys”.

  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.

That’s it.

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