Improve speed on foreign keys extraction for database with huge number of tables.