1

I'm using the following query:

SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM TABLE_NAME ;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ ;

The table has lots of write operations and heavy read operations. To get a minimum effect from the read operations I wanted to use nonlocking read operations. In MySql it is done with "READ UNCOMMITTED" (according to what I read).

How to test whether this code is actually working?

Buntu Linux
  • 492
  • 9
  • 19

1 Answers1

1

first connection :

 MariaDB [(none)]> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> INSERT INTO t2 VALUES(1),(3);
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> use test
Database changed
MariaDB [test]> INSERT INTO t2 VALUES(1),(3);
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

no commit this TRANSACTION

second connection

MariaDB [test]> SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> SELECT * FROM t2;
+------+
| i    |
+------+
|    1 |
|    3 |
+------+
2 rows in set (0.00 sec)

MariaDB [test]> COMMIT ;

 MariaDB [test]> select * from t2;
Empty set (0.00 sec)
zloctb
  • 10,592
  • 8
  • 70
  • 89