ActiveRecord, MySQL and nested transactions - what is the behavior?

Rails uses savepoints to achieve nested transactions with MySQL, and as far as I know, the semantics of this are identical to actual nested transactions in terms of atomic data changes.

  • It's true?
  • How about calling save at arbitrary points in time in the code? The transaction remains open until the end of the block, right? Are there any differences in behavior when using nested transactions / savepoints?
  • What else do you need to know?
  • [deliberately inciting the flames of war] Should I switch to PostgresSQL?
+3
source share
2 answers
  • , , - MS SQL Server

  • , , , , , (. № 3 ).

  • Model.transaction(: require_new = > true) -, , , , , , . , , , .

  • , PostgresSQL ( ), .

+3

, Mysql Savepoints MySQL 5+. , , Rails 2.3.2+ Mysql 5 +.

. , , , , - (IMHO).

+1

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


All Articles