Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor optimization: avoid adding new values rows on del in slices #86

Open
pascallouisperez opened this issue Mar 12, 2018 · 0 comments
Milestone

Comments

@pascallouisperez
Copy link
Contributor

Currently, we store refs to slices in the worksheet_values table as [:max_rank:slice_id. Since we always add a row if a value is dirty, we "duplicate" rows with same max_rank on deletes.

For instance, here is an example of three consecutive changes: 1. add an element, 2. add a second element, and 3. delete both elements. The resulting worksheet_values table looks as so:

ws_test=# select from_version, to_version,value from worksheet_values where index = 42;
 from_version | to_version |                   value                   
--------------+------------+-------------------------------------------
            1 |          1 | [:89:ba50ec84-4444-4325-a372-d8c430429fa6
            2 |          2 | [:90:ba50ec84-4444-4325-a372-d8c430429fa6
            3 | 2147483647 | [:90:ba50ec84-4444-4325-a372-d8c430429fa6
(3 rows)

For the 3rd change, we need to update the worksheets table's version column (for concurrency control), as well as update the worksheet_slice_elements to change the to_version of the deleted elements, but we do not need to add a row in the worksheet_values table.

@pascallouisperez pascallouisperez added this to the 0.3 milestone Mar 12, 2018
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

No branches or pull requests

1 participant