transaction-isolation

In MySQL Why does setting a variable from a select acquire a lock when using read uncommitted?

不羁岁月 提交于 2021-01-27 04:02:31
问题 We have a table in MySQL using InnoDB, and we are using a transaction isolation level of read uncommitted. Why does setting @x as shown acquire a lock? mysql> set @x = (select userID from users limit 1); Query OK, 0 rows affected (0.02 sec) mysql> Trying to update this table from another prompt results in a timeout error: mysql> update users set userID = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 回答1: For what it's worth, this locking is not limited to READ

In MySQL Why does setting a variable from a select acquire a lock when using read uncommitted?

孤者浪人 提交于 2021-01-27 04:01:03
问题 We have a table in MySQL using InnoDB, and we are using a transaction isolation level of read uncommitted. Why does setting @x as shown acquire a lock? mysql> set @x = (select userID from users limit 1); Query OK, 0 rows affected (0.02 sec) mysql> Trying to update this table from another prompt results in a timeout error: mysql> update users set userID = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 回答1: For what it's worth, this locking is not limited to READ

PostgreSQL Transaction Isolation READ UNCOMMITTED

 ̄綄美尐妖づ 提交于 2020-02-03 04:40:56
问题 I want to try transaction isolation using PostgreSQL with pgadmin. First I inserted a new record inside BEGIN but without COMMIT. BEGIN; INSERT INTO my_table(id,value) VALUES (1,'something'); //UNCOMMITTED Then, I tried to read the uncommitted data BEGIN TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT * FROM my_table COMMIT; But I couldn't find the new record. What's wrong? 回答1: PostgreSQL does not support dirty reads ( READ UNCOMMITTED ). As @a_horse_with_no_name pointed out, the manual

What is default isolation level hibernate uses if not explicitly set?

家住魔仙堡 提交于 2020-01-22 05:14:07
问题 I have an application that uses hibernate version 3.6.4, and c3p0 version 0.9.1.2 for connection pooling. My underlying RDBMS is MySql version 5.0.67. My installation of MySql indicates that the default transaction isolation level is "REPEATABLE-READ" (4): mysql> select @@GLOBAL.tx_isolation, @@tx_isolation; +-----------------------+-----------------+ | @@GLOBAL.tx_isolation | @@tx_isolation | +-----------------------+-----------------+ | REPEATABLE-READ | REPEATABLE-READ | +-----------------

Is it okay if from within one stored procedure I call another one that sets a lower transaction isolation level?

巧了我就是萌 提交于 2020-01-13 16:18:09
问题 I have a bunch of utility procedures that just check for some conditions in the database and return a flag result. These procedures are run with READ UNCOMMITTED isolation level, equivalent to WITH NOLOCK. I also have more complex procedures that are run with SERIALIZABLE isolation level. They also happen to have these same kind of checks in them. So I decided to call these check procedures from within those complex procedures instead of replicating the check code. Basically it looks like

What is the correct isolation level for Order header - Order lines transactions?

房东的猫 提交于 2019-12-25 09:44:09
问题 Lets say we have a usual situation with Order_Header and Order_LineItems tables. Also, lets say we have transactions for creating, updating and selecting Orders. Like: Create: BEGIN TRANSACTION INSERT INTO Order_Headers... SET @Id = SCOPE_IDENTITY() INSERT INTO Order_LineItems...(using @Id) DECLARE @SomeVar INT --just example to show update dependant on select SELECT @SomeVar = COUNT(*) Order_Headers WHERE OrderDate > '1-1-2017' UPDATE Order_Headers SET SomeValue = @SomeVar WHERE Id = @Id

Transaction management with Spring and hibernate, using isolation_serializable

和自甴很熟 提交于 2019-12-23 23:16:50
问题 I am using Spring transaction management to control a application with hibernate, it uses two instance of threads to access concurrency database and modify one table. It is ensuring that the values are conserved. The table before is: quantidade_livro_id | quantidade | livro_id | tt ---------------------+------------+----------+---- 7 | 100 | 3 | as 5 | 100 | 1 | as 6 | 100 | 2 | as And the table after: quantidade_livro_id | quantidade | livro_id | tt ---------------------+------------+-------

How to set isolation level in @Transactional “READ_UNCOMMITTED”. I am using EclipseLink 2.5.1-RC1

只愿长相守 提交于 2019-12-23 12:35:37
问题 I have a requirement to start new Transaction within an ongoing Transaction so that an exception in 2nd transaction will rollback only new transaction not the old one. This I am doing by setting propagation attribute in 2nd transaction like this: @Transactional(propagation = Propagation.REQUIRES_NEW) This created a new Transaction, but the new Transaction needs to read some uncommitted data of the first transaction (dirty read), and also update that data. This I am trying to do by setting

Can a locked row [in Postgres] still be read from?

心不动则不痛 提交于 2019-12-23 07:47:18
问题 If I SELECT... FOR UPDATE a row in a transaction, it will obviously block the row from being written to, but will it disallow reads as well? I'd prefer to still be able to read from the row, so if the answer is yes, can you provide a solution to work this? 回答1: You can read just fine. There are lock modes that prevent reading but this isn't one of them. http://www.postgresql.org/docs/current/static/explicit-locking.html 来源: https://stackoverflow.com/questions/12029470/can-a-locked-row-in