-
Notifications
You must be signed in to change notification settings - Fork 38
queryid equals 0 for some wait events #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
if I select pg_stat_activity backends with SyncRep wait event it's always have smth in query column (commit or real query)
or
|
Greetings In general case, we use existing PostgreSQL hooks to track query execution. To be exact we use various executor hooks. All activities you have described (IPC, SyncRep and WALWrite) do not go through the executor and thus query_id is never set for them We set query_id at the start of query execution and zero it when query finishes execution. For IPC and WALWrite events we don't have any available hooks to log those as we do with regular query execution |
many thanks for clarification. |
If we would save query_id of last executed query until we got a new one we would run into a problem - we would get a lot of ClientRead wait events with last saved query_id; but those waits have nothing to do with last executed query, we just wait for user to input next query Also we use the same way of tracking query_id as pg_stat_statements so we could join both views. With "lingering" query_ids those joins could be inaccurate |
If you have further questions - feel free to ask here or in a new issue, but for now I'll close it |
Good evening
I've noticed that for real client backend pids (not PG server processes) some wait events always have 0 in queryid column in all pg_wait_sampling views. So far I found that all IPC type events, SyncRep and WALWrite events have queryid = 0, for example
PG version is 13.18
as far as I understood from source code 0 is set for queryid if
nesting_level == 0
but I can't understand why it happens for that wait events, could you please help me with itThe text was updated successfully, but these errors were encountered: