USA - Toll Free: +1-866-221-0634
USA - From abroad: +1-408-701-9009
USA - Subscription Renewals: +1-866-830-4410
Latin America: +1 512 535 7751
UK: +44 845 399 1124
Ireland: +353 1 6919191
Germany: +49 89 420 95 98 95
France: +33 1 70 38 72 00
Sweden: +46 730 207 871
Benelux: +358 50 5710 528
Italy: +39 06-99268193
Israel: +358 50 5710 528
Spain & Portugal: + 34 933905461
Other EMEA countries: +353 1 6919191
Asia Pacific: +81 3 5918 7507
Learn about new MySQL releases, technical articles, events and more.
How (where) does Innodb store information about foreign keys?
Foreign keys are stored in InnoDB tables SYS_FOREIGN and SYS_FOREIGN_COLS.
InnoDB stores foreign key constraints as separate objects. When we take a table to use, InnoDB searches all foreign key constraints for that table as well as the ones that reference that table (note above that we have secondary indexes on table names). It caches the foreign key information to the data dictionary cache in main memory. Thus, foreign key info is very quickly available for any operation on the table.
