Skip to content

Conversation

@hkrutzer
Copy link
Contributor

@hkrutzer hkrutzer commented Nov 4, 2019

As discussed with @josevalim here we are seeing a performance regression in some cases due to no longer having an LRU cache, which Mariaex does have. José mentioned Postgrex reuses repeated prepared statements, which is what this PR implements.
Of course I am open to other implementations. I have not looked at the Postgrex code because augmenting the last_ref seemed easier, but if Postgrex has a better way of accomplishing this then I'm willing to take a look there.

@hkrutzer hkrutzer force-pushed the unnamed-reuse-statements branch from e3f5ff0 to 1b6ab14 Compare November 4, 2019 10:35
@josevalim
Copy link
Member

Looks great! Are you running it in prod? How is it behaving?

@hkrutzer
Copy link
Contributor Author

hkrutzer commented Nov 4, 2019

We've been running it on staging for a bit, where we do around 1500 queries a second, and we've not seen any errors and the prepared statement count is stable.

@wojtekmach wojtekmach merged commit ee3603d into elixir-ecto:master Nov 4, 2019
@wojtekmach
Copy link
Member

Thank you!

jeroenbourgois added a commit to jackjoe/myxql that referenced this pull request Nov 5, 2019
* 'master' of github.com:jackjoe/myxql:
  Re-use repeated prepared statements in unnamed mode (elixir-ecto#83)
  Fix flaky test
  Move ssl test to sync_test.exs to avoid races
  Release  v0.2.10
  Add prepare: :force_named, closes elixir-ecto#60
  Do not leak statements in other operations
  Do not leak prepared queries, closes elixir-ecto#80
  Make sure :unnamed :statement query get cleaned in cache
  Do not leak with prepare: :unnamed and cache: :statement
  Fix public_key_exchange check
  Parse results out of TestHelper.mysql/1
  Fix typo in README.md (elixir-ecto#81)
wojtekmach added a commit that referenced this pull request Nov 28, 2019
hkrutzer added a commit to hkrutzer/myxql that referenced this pull request Nov 28, 2019
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

Successfully merging this pull request may close these issues.

3 participants