Skip to content
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

duplicated qpid in logs when pg_stat_sql_plans.explain=true #27

Open
legrandlegrand opened this issue Jun 10, 2020 · 1 comment
Open
Assignees

Comments

@legrandlegrand
Copy link
Owner

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

https://www.postgresql-archive.org/pg-stat-statements-duplicated-external-query-texts-with-MSY2-td6140505.html

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).

@legrandlegrand legrandlegrand added the wontfix This will not be worked on label Jun 10, 2020
@legrandlegrand legrandlegrand self-assigned this Jun 10, 2020
@legrandlegrand legrandlegrand removed the wontfix This will not be worked on label Jun 11, 2020
@legrandlegrand
Copy link
Owner Author

An other solution, would be to move explain text writing in log, into entry_alloc(explain text has to be added as parameter).
This seems the better solution to fix that issue and could be a step towards storing explain plan text in memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant