postgres-nio icon indicating copy to clipboard operation
postgres-nio copied to clipboard

PostgresClient performance decrease when executing the same queries consecutively

Open duncangroenewald opened this issue 1 year ago • 6 comments

Describe the issue

When running the same fairly complex set of queries (using the same client ) performance in each subsequence execution slows down - e.g first time 5.2 seconds, next time 5.6, next 6.0, etc. and it tends to keep climbing to over 8 seconds and probably more - I stopped testing.

Vapor version

postgres-nio 1.22.1

Operating system and version

macOS 14.6.1

Swift version

5.10.0

Steps to reproduce

A little tricky to reproduce given the number of queries in each execution run.

Restarting the client application seems to always get performance back to 5.2 seconds. Is there some cleanup necessary when using PostgresClient. Note that each execution creates a new PostgresClient but all the queries within the execution run use the same client.

Outcome

I would expect to see identical performance in each subsequent execution run - or at least within 0.1 seconds since the performance on restarting the application is nearly identical the first time the execution is run.

Additional notes

Not running Vapor - just using the PostgresClient from a macOS client application

duncangroenewald avatar Oct 02 '24 13:10 duncangroenewald