Skip to content

Commit

Permalink
Use INSERT ... ON DUPLICATE KEY instead of REPLACE
Browse files Browse the repository at this point in the history
There are sources on the Internet that indicate that this should be faster.
  • Loading branch information
mhutchinson committed Dec 5, 2023
1 parent 5696d6d commit 6af1cb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/mysql/tree_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

// These statements are fixed
const (
insertSubtreeMultiSQL = `REPLACE INTO Subtree(TreeId, SubtreeId, Nodes, SubtreeRevision) ` + placeholderSQL
insertSubtreeMultiSQL = `INSERT INTO Subtree(TreeId, SubtreeId, Nodes, SubtreeRevision) ` + placeholderSQL + ` ON DUPLICATE KEY UPDATE Nodes=VALUES(Nodes)`
insertTreeHeadSQL = `INSERT INTO TreeHead(TreeId,TreeHeadTimestamp,TreeSize,RootHash,TreeRevision,RootSignature)
VALUES(?,?,?,?,?,?)`

Expand Down

0 comments on commit 6af1cb4

Please sign in to comment.