Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[12.0.167 BETA] - Process message update frequency |
|
What is the frequency of updating the process message?
In this screenshot below
the messages pane shows "Processing line 2 of 15...". But according to the Session Monitor, the server is already processing the 11th line (including the comments). And please, disregard the discrepancy of the actual line numbers shown in the editor, I moved the whole text closer to the result pane by adding newlines to avoid having to create a large screenshot.
|
|
Mon Oct 18, 2021 6:28 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The line number in the messages is relative to the executed code. If you highlight a block of code in a middle of the file, and run it, line 2 would refer to the second line of that block, not the start of the file.
|
|
Mon Oct 18, 2021 7:18 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Yes, I know, but that's irrelevant here. I only mentioned it to make sure you're aware that though the screenshot does not indicate highlighted execution (as it was not started as one), there isn't anything on line 2 that could make the status message true and the discrepancy between the line number shown by the status message and the actual line in the editor is my doing. It does not change the fact that the status message says it is currently processing line 2 while it is already processing line 11.
|
|
Tue Oct 19, 2021 8:01 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Any updates on this one?
|
|
Mon Sep 19, 2022 3:49 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
It looks weird to me that the status bar is showing all ALTER INDEX commands in the same line as if all of them are executed as a single SQL block.
Is there a GO below the visible area?
|
|
Mon Sep 19, 2022 8:13 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
No, there weren't any GOs. But you gave me an idea and reproduced that test case. It seems that the status only updates after it meets a GO.
Check this short video here. I've inserted a couple of WAITFORs to control the flow because the DISABLE statement is near instantaneous. When I start the execution, it immediately shows in the status bar and I can see it in the Session Monitor as well. But it does, indeed, say that it is running all the stuff in the first batch, and does not consider them as things that are run separately, even though the Session Monitor knows exactly which statement is currently running.
|
|
Mon Sep 19, 2022 8:48 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I'm pretty sure it's not executing each ALTER separately. It's executing the entire T-SQL block or script if there is no GO as a single atomic operation. Because there are no messages printed after each ALTER, you don't see progress of work messages. The status bar message indicates it's executing the entire block with the beginning of the code visible in the status message. It lets SQL Server do code parsing and interpretation.
Just in case, that behavior is different from MySQL, which doesn't support anonymous code blocks, so parsing is done by the editor.
|
|
Mon Sep 19, 2022 9:33 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
The server definitely executes each statement separately (what other way could it be done?). I don't know how SA/SE perceives what's happening inside the server with the statements SA/SE as a query, I simply assumed that it periodically checks which statement the server is at that moment and it compares to the statements that have been passed to it because I guess that's the simplest thing it could do to achieve a reasonable level of accuracy as the Session Monitor does. That does not seem to be the case here (perhaps for performance reasons?). The status bar showing all the statements in the same batch concatenated to a single line is a good indicator of that, that I should have noticed, have I paid attention, which I obviously didn't :(
|
|
Mon Sep 19, 2022 10:09 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
That status bar is showing client's side/text of what has been sent to the server for execution. It has no way of knowing server progress othen displaying in the Messages what comes back from the server. Line 2 is simply the starting number of the second T-SQL batch. What i cannot see above line 14 belongs to the first T-SQL batch. What seems to be confusing here is that it's referring to it generically as statement 2 instead of batch 2. Choice of generic words isn't helping here.
The difference here, in case of SQL Server it sends each T-SQL batch in one go, while in case of MySQL it parses out each individual statement and sends it separately as it cannot send them as a batch. Hope my example helps here.
|
|
Mon Sep 19, 2022 1:15 pm |
|
 |
|