Description:
The variable statement_id is only found in the documentation as part of the description of session_track_system_variables.
"To enable display of the Statement ID for each statement processed, use the statement_id variable. For example:
mysql> SET @@SESSION.session_track_system_variables='statement_id'
mysql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.0006 sec)
Statement ID: 603835
"
I don't know if this is an oversight or if the variable and its usage is considered self-explanatory and does not merit an individual listing within the other system variables. It is clearly a read only variable and perhaps it should be documented more fully.
How to repeat:
refer to https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_session_track_... for the only reference to statement_id as a variable and not as a field in the performance_schema.prepared_statements_instances table.
Suggested fix:
I cannot really say this variable demands its own listing with the rest of the sys vars. It caused me a bit of confusion at first looking for it, but I quickly realized its use. I leave it up to you to decide if it should be more fully documented as a variable. For what it is worth other read-only variables are documented: e.g. build_id, ngram_token_size, etc.
Cheers!
Dov Endress