MySQL useful / viable FK in web application?

I came across this discussion related to FK and web applications. Mostly some say that FK in web applications does not represent a real improvement and can even make the application slower in some cases.

What do you guys think your experience is?

edit : note that I know about the work and the FK object, I'm just not sure that they will have a significant negative impact on the performance of a web application such as youtube or something similar,

-

Quote from Heikki Tuuri , creator of the InnoDB engine, founder and CEO of Innobase:

InnoDB checks foreign keys as soon as a row is updated, without batch processing being executed or checked with a delay before transaction commits. Foreign keys are often serious overhead, but help maintain data consistency.

Foreign keys increase the number of rows level lock and make it apply to many tables except directly updated

+3
source share
8 answers

. , , , , , , - . DB . , , .

, , FK -, , , (.. , , , FK). , , , ( JOINs , , ).

, 1 - " ", 2 - " ()". , :

1) .

2) (.. , , , )

3) , (, , )

+3

, order_details order_id, orders, order_id, orders.

, , , , (.. ). C ACID.

, , , , . , , .

, , MySQL, Microsoft Patterns and Practices: 14 SQL Server:

, .

+14

- , , muppet , . , .

+9

- . , , , .

, (- *), , , -, , , - , .

(*: . , , jerry-rigs - , .)

+5

, ( ), :

( , cdonner)

+5

- , . :

  • ,
  • ..

, , , , .

IMHO, ( ) .

+3

- , . , . , , , .

, , , . , - .

+1

, , - . ( , , ). , . , , . Linq-to-SQL . - , .

+1

Source: https://habr.com/ru/post/1748139/


All Articles