dialect/sql/sqlgraph: avoid creating tx blocks for single statement create operation#1858
Merged
dialect/sql/sqlgraph: avoid creating tx blocks for single statement create operation#1858
Conversation
…reate operation For example, in PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for CreateNode operation with single SQL statement. Benchmark was improved from: (2000 Inserts) 8.41s 4206748 ns/op 4595 B/op 115 allocs/op To: (2000 Inserts) 4.66s 2330222 ns/op 4107 B/op 104 allocs/op
a8m
added a commit
that referenced
this pull request
Aug 27, 2021
…ements In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for DeleteNodes operation as it's implemented with a single statement. Benchmark for 4000 operations was improved from: 14.54s 7270455 ns/op 3702 B/op 81 allocs/op To: 5.36s 2679935 ns/op 2864 B/op 59 allocs/op --- MySQL and SQLite share the same behavior. Please see #1858 for more info.
a8m
added a commit
that referenced
this pull request
Aug 27, 2021
…ements In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for DeleteNodes operation as it's implemented with a single statement. Benchmark for 4000 operations was improved from: 14.54s 7270455 ns/op 3702 B/op 81 allocs/op To: 5.36s 2679935 ns/op 2864 B/op 59 allocs/op --- MySQL and SQLite share the same behavior. Please see #1858 for more info.
a8m
added a commit
that referenced
this pull request
Sep 11, 2021
…ements In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for UpdateNodes operation with a single UPDATE statement. Benchmark for 2000 operations was improved from: 7.98s 3992160 ns/op 4887 B/op 116 allocs/op To: 4.42s 2209659 ns/op 4435 B/op 104 allocs/op --- MySQL and SQLite share the same behavior. Please see #1858 for more info.
a8m
added a commit
that referenced
this pull request
Sep 11, 2021
…ements In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for UpdateNodes operation with a single UPDATE statement. Benchmark for 2000 operations was improved from: 7.98s 3992160 ns/op 4887 B/op 116 allocs/op To: 4.42s 2209659 ns/op 4435 B/op 104 allocs/op --- MySQL and SQLite share the same behavior. Please see #1858 for more info.
a8m
added a commit
that referenced
this pull request
Sep 11, 2021
…ements In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT) for UpdateNodes operation with a single UPDATE statement. Benchmark for 2000 operations was improved from: 7.98s 3992160 ns/op 4887 B/op 116 allocs/op To: 4.42s 2209659 ns/op 4435 B/op 104 allocs/op --- MySQL and SQLite share the same behavior. Please see #1858 for more info.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For example, in PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction
blocks manually (group of statements surrounded by BEGIN and COMMIT) for
CreateNodeoperations with a single SQL statement.Benchmark (based on @mattn reference) was improved from:
To:
MySQL doc:
SQLite doc: