Add table option to skip empty updates #66
Merged
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 updates on views that happen to not change any columns (e.g. a
SET col = LOWER(col)
where all values incol
were already in lower case), we currently insert an empty update operation into the local upload queue. While this can be resolved by users rewriting SQL statements and typically shouldn't make up a bulk of the queue, we've seen a report claiming that skipping empty updates speeds up uploads: powersync-ja/powersync-kotlin#144.Ignoring empty updates entirely might break users relying on the current behavior, so this adds an opt-in option to ignore schema updates. For this, the
powersync_crud_
vtab gains a new hidden column with option flags that can be set for inserts.FLAG_IGNORE_EMPTY_UPDATE
, which is disabled by default, would make an insert intops_crud
do nothing if it's an empty update.