Why does START TRANSACTION doesn't affect on autocommit implicitly as it should

Viewed 1968

So this is from the docs:

To disable autocommit mode implicitly for a single series of statements, use the START TRANSACTION statement:

START TRANSACTION;
SELECT @A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summary=@A WHERE type=1;
COMMIT;

So from my understanding, unlike using BEGIN; command which shouldn't set autocommit to 0, START TRANSACTION should set it to 0.

Now if I do this (after I start a transaction):

select @@autocommit;

I get the value of 1.

Why autocommit is still enabled even if I use START TRANSACTION command? I thought that the autocommit variable is local to a single session. Or maybe even if it says 1, it is actually set to 0 within a transaction but just can't get that info by running a SELECT @@autocommit; query?

2 Answers
Related