Skip to Main Content
  • Questions
  • Does Foreign Key constraint (No Validate) impact on performance?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Rajendra.

Asked: September 22, 2017 - 12:14 pm UTC

Last updated: September 23, 2017 - 4:07 am UTC

Version: 11G

Viewed 1000+ times

You Asked

We have imported data from PROD to UAT environment. While import foreign key constraints enabled as No Validate. Both the tables parent table and child tables have huge number of rows.

How can we tune the queries referencing to these two tables, since whenever we are using these two tables in join it is taking considerable time to fetch the rows.

Thanks in Advance,

Rajendra Sowani.

and Connor said...

Constraints that are not validated can change the way your queries are executed.

See this article for some examples why

http://www.oracle.com/technetwork/testcontent/o39asktom-096149.html

So you can either do:

alter table XXX modify constraint enable validate

(which does not lock the table)

or look at setting the RELY property, which is you telling the database that even though validation has not been done, the database can "rely" on the data being valid.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.