-
Notifications
You must be signed in to change notification settings - Fork 1
Description
This appears with
pgbench -c20 -t5 (a kind of query storm ...)
on my MSYS2 (windows 10), but not on linux ...
It also appears in native pg_stat_statements as described here
In fact, in pgss_store, the query is written in external query text file, before taking the EXCLUSIVE
lock ...
/* Append new query text to file with only shared lock held */
stored = qtext_store( query, query_len,
&query_offset, &gc_count);
in case of query storm, to prevent this, there should be no action between first hash_search and exclusive lock promotion ...
removing this action (forcing usage of the qtext_store reserved for gc cases under exclusive lock ) seems to help a lot for this issue, but should slow other tests cases (with many distincts queries for exemple).
Ideal solution would be to move this part after hash entry creation, outside exclusive lock,
query length and offset being updated with counters (but this is a big change).