Hi!
I have following configuration set in my.cnf (MySQL version 5.5.16):
[mysqld]
# General settings
datadir=/opt/mysql
# InnoDB settings
innodb_data_home_dir=/opt/mysql/ibdata
innodb_data_file_path=ibdata01:50M:autoextend:max:5G
innodb_autoextend_increment=10M
innodb_log_group_home_dir=/opt/mysql/ibdata/log
init_connect='SET autocommit=0'
Now I tried following:
Connect to database test two times (means with to different sessions), after that:
Session A:
create table auto_test (id int(10));
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
Session A:
insert into auto_test values(1);
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 1 |
+----------+
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
So far so good, beacuse there was no commit in Session A until now.
Session A:
commit;
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
And that is the thing I don't get, why does Session B don't see the inserted row? Now I make a new third session:
Session C:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 1 |
+----------+
Can somebody explain me why only new connections see the insertes row?
I have following configuration set in my.cnf (MySQL version 5.5.16):
[mysqld]
# General settings
datadir=/opt/mysql
# InnoDB settings
innodb_data_home_dir=/opt/mysql/ibdata
innodb_data_file_path=ibdata01:50M:autoextend:max:5G
innodb_autoextend_increment=10M
innodb_log_group_home_dir=/opt/mysql/ibdata/log
init_connect='SET autocommit=0'
Now I tried following:
Connect to database test two times (means with to different sessions), after that:
Session A:
create table auto_test (id int(10));
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
Session A:
insert into auto_test values(1);
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 1 |
+----------+
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
So far so good, beacuse there was no commit in Session A until now.
Session A:
commit;
Session B:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 0 |
+----------+
And that is the thing I don't get, why does Session B don't see the inserted row? Now I make a new third session:
Session C:
select count(1) from auto_test;
+----------+
| count(1) |
+----------+
| 1 |
+----------+
Can somebody explain me why only new connections see the insertes row?