9

Can't really find any details on this, but is the scope of 'SET foreign_key_checks = 0' the current connection, current session or current transaction?

sbrattla
  • 5,120
  • 3
  • 36
  • 60
  • 1
    I'd say that my question is formulated better than the one referred to above. At least my question ends with a question mark... – sbrattla Aug 16 '13 at 20:19

2 Answers2

8

It's a session-based statement.

This is to temporarily break the Foreign Key Constraint. It is sometimes necessary to change data in a way that referential integrity needs to be broken during the modification process.

John Woo
  • 249,283
  • 65
  • 481
  • 481
7

It is session-based. Full answer and explanation can be found in this other Stack Overflow answer:

“It is session-based. Do a test to be sure, but that's my understanding of it.”

Giacomo1968
  • 24,837
  • 11
  • 67
  • 96