This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)

It's highly recommended to be running the latest (+ version) available of your Moodle release before executing the search for potential violations of the foreign keys.

This functionality doesn't perform any action against the DB (just reads from it), so can be safely executed at any moment.