Skip to content

Instantly share code, notes, and snippets.

@armon
Created April 27, 2014 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armon/11349709 to your computer and use it in GitHub Desktop.
Save armon/11349709 to your computer and use it in GitHub Desktop.
1) Create table "kvs"
2) Create table "kvs_id_idx"
3) For insert:
a) Insert into kvs (rowid, data blob)
b) Insert into kvs_id_idx (key, rowid)
4) For delete:
a) Iterate across kvs_id_idx
b) Delete kvs where rowid matches
c) Cursor.Del() on kvs_id_idx
First you need to inject some data for this case to appear.
It seems that with 128 entries of reasonable legnth is fine.
(~75 byte key, ~100 byte value). Key is of format <uuid>/<uuid>.
Then inject some more data, same key/value size. About 128
entries is fine. Then iterate over this second set of data,
and try to delete all the rows. With very high probability
the cursor will not iterate over all 128 entries.
Effectively, I'm simulating multiple indexes by
having a single table store the (rowid, data) tuple, and
all the other tables are just indexes into that table.
Deletes iterate over an index while deleting the true
data rows, however the index scan does not reach all the
expected keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment