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

workload: large number of DEALLOCATE statements after pgx upgrade #69316

Closed
rafiss opened this issue Aug 24, 2021 · 2 comments · Fixed by #69313
Closed

workload: large number of DEALLOCATE statements after pgx upgrade #69316

rafiss opened this issue Aug 24, 2021 · 2 comments · Fixed by #69313
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@rafiss
Copy link
Collaborator

rafiss commented Aug 24, 2021

After the pgx upgrade in #68608 various workloads seem to be running huge numbers of (hundreds to thousands) DEALLOCATE statements. These are commands that delete a prepared statement.

The behavior change started after August 17, which was when the upgrade PR was merged. The new pgx behavior is to use a stmtcache, which is an LRU cache that automatically prepares any statement executed by pgx. When an entry is evicted from the LRU cache, the statement is deallocated. See https://github.com/jackc/pgconn/blob/53f5fed36c570f0b5c98d6ec2415658c7b9bd11c/stmtcache/lru.go#L118

Previously, the workload would explicitly prepare the statements it needs to use (and these would never get deallocated), but that behavior was removed because pgx no longer allows you to prepare a statement at the connection pool level. See commit f446498

Perhaps we need to do something else to make sure the workload SQL statements don't get deallocated.

This issue might be causing the failures of #69086 but that investigation is happening separately, in parallel. (see #69317)

@rafiss rafiss added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Aug 24, 2021
@rafiss rafiss self-assigned this Aug 24, 2021
@blathers-crl blathers-crl bot added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Aug 24, 2021
@rafiss
Copy link
Collaborator Author

rafiss commented Aug 24, 2021

Trying to bring back the old prepare workload behavior in #69313

@rafiss
Copy link
Collaborator Author

rafiss commented Aug 24, 2021

Ah I see, jackc/pgx@0c3e59b is new in pgx4 and enables this automatic prepared statement caching.

@rafiss rafiss linked a pull request Aug 25, 2021 that will close this issue
@craig craig bot closed this as completed in #69313 Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant