Skip to content

Persist prepared commands - #1053

Closed
MarkusSintonen wants to merge 15 commits into
npgsql:developfrom
MarkusSintonen:feature/persist-prepare-3.1
Closed

MarkusSintonen wants to merge 15 commits into
npgsql:developfrom
MarkusSintonen:feature/persist-prepare-3.1

Conversation

@MarkusSintonen

Copy link
Copy Markdown
Contributor

Implementation for #483

roji and others added 14 commits April 13, 2016 17:42
* Npgsql now builds on rc2 with dotnet cli, targeting netstandard1.3
* GeneratedAsync.cs is now checked in and rewrite-async isn't automatically
  executed as part of the build. It can be executed manually by doing
  'dotnet rewrite-async'.
* Killed old/unused EntityFramework5.Npgsql.Tests
-Changing the CommandText in NpgsqlCommand does not deallocate the old persitent command anymore
-Changed more members to internal
-Added tests for persistent commands
-Member to internal
- Modified code to be compatible with newer version
… prepared statements as default

- Persisted prepared statements are now deallocated when command text changes
- Changed tests accordingly
@MarkusSintonen MarkusSintonen changed the title Feature/persist prepare 3.1 Persist prepared commands May 1, 2016
@roji
roji force-pushed the develop branch 10 times, most recently from beae0a3 to 968113d Compare May 10, 2016 16:14
@roji roji closed this May 12, 2016
@roji

roji commented May 12, 2016

Copy link
Copy Markdown
Member

@MarkusSintonen this PR has been closed cause I renamed the develop branch to dev.

Could you please clean up/squash your commits and resubmit a PR against dev?

@MarkusSintonen

Copy link
Copy Markdown
Contributor Author

@roji the new pull request is now at #1084

@roji

roji commented May 24, 2016

Copy link
Copy Markdown
Member

I've taken a very quick look, here are some remarks.

  • Thanks for the extensive tests!
  • Seeing the API at work, maybe we should simply have an overload of Prepare() which accepts a boolean rather than a separate IsPersistent property?
  • Is there any particular reason we need the new PersistentPreparedCommand and PersistentPreparedParameter? Can't we just have a simple dictionary cache, mapping statement SQLs to PostgreSQL persistent statement names?
  • Related to the last point - in my mind all caching would happen at the statement level, rather than at the command level - since this is what is actually prepared on the PostgreSQL side. In other words, when I prepare a persistent command, we parse the text as usual, and for each of the statements resulting from the parse, we check if there's a match in the persistent statement cache. If so, we simply use the prepared statement name and that's it. I think this would also make management simpler in general.
  • Especially if the above works, I'd simply fold PersistentPreparedRegistry into the connector, the split into another class seems to create more complexity than it saves... It's just two data structures...
  • Any specific reason for using Guids in prepared statement names? This just seems to make everything harder to follow - why not a simple counter as before?

Let me know what you think of the above, if you want I can do a PR of my own for comparison.

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.

2 participants