Why does the semantic engine add a delay to scheduling semantic analysis tasks when it triggers completion? #38932
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
@howmushroomsay Thank you for your report. We need to ask why and report back to you. |
Beta Was this translation helpful? Give feedback.
-
|
The description of your findings looks as if you found DBeaver always introducing unwanted delay, which simply is not true. It highly depends on the circumstances, query structure, state of the metadata cache, concrete editing sequences and precise key press timings in the whole scenario. To better understand what is really happening in your case, it would be helpful to introduce a certain amount of debug logging and measuring all around the SQLBackgroundParsingJob and SQLCompletionProcessor. Particular scheduling delay is just a small piece in a bigger picture. Let me try to describe how it works.
Any key press here might or might not change the editor state, might or might not trigger parsing and invalidate already prepared pieces of information from the previous steps.
So we are actually reducing the delay when possible and adding only when the parsing is already running but will be triggered later again. Note that by the time the schedule method is called, parsing may already be running, and we don't know how much time it will take. There may be HUGE queries, whose analysis requires more than 2 seconds.
When the user just types, not really reading what is on the screen (1), there is no point in parsing and doing complex highlighting, because they just type no matter what is currently on the screen, until their current considerations' part will be expressed. For example, you are entering a word (a name of something, or a keyword). You won't stop pressing keys until you accomplish the intention of entering this word. Then you think about what to do next and whether it is correct or not (2) - and here is the moment to assist! Or you remembered something while entering the word and now you are immediately deleting it, without waiting for the editor to react and highlight it (1), to then type in the other thing. Or to stop typing and do something else (2). Summing it all up, there are at least two points to have delays between input events and parsing activities:
There are well-established foundations of UI responsiveness time limits (see here for some references), of which it is known that an expected computer reaction within one second doesn't break the train of the user's thought. Basically, if you are using any other modern IDE, like JetBrains IDEA for example, you can notice how editor reacts for input key presses: there is always a fraction of second between the input and the editor reaction (coloring update and/or completion list appearance), so that the editor has its chance to know if it faces with continuous input or the user is ready to observe the feedback. P.S. Note that all of these details don't cover metadata queries required by both analysis and completion engines when the connection was recently established and its metadata cache has not yet been populated. Cold metadata queries may take a noticeable amount of time. Upcoming activities using cached information work much faster. |
Beta Was this translation helpful? Give feedback.

The description of your findings looks as if you found DBeaver always introducing unwanted delay, which simply is not true. It highly depends on the circumstances, query structure, state of the metadata cache, concrete editing sequences and precise key press timings in the whole scenario. To better understand what is really happening in your case, it would be helpful to introduce a certain amount of debug logging and measuring all around the SQLBackgroundParsingJob and SQLCompletionProcessor. Particular scheduling delay is just a small piece in a bigger picture. Let me try to describe how it works.
There are two subsystems: semantic analysis and completion. They are connected, but diffe…