Skip to content

Instantly share code, notes, and snippets.

@nirbhayc
Created January 17, 2019 18:51
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 nirbhayc/5152b40706efe2e951044eb1f99f6307 to your computer and use it in GitHub Desktop.
Save nirbhayc/5152b40706efe2e951044eb1f99f6307 to your computer and use it in GitHub Desktop.
comdb2/sqlite plan (commit: 3087047)
nctdb> update sbtest1 set k=k+1 where id=1;
+-------------------------------------------------------------------------------------------------------------------------------+
| Plan |
+-------------------------------------------------------------------------------------------------------------------------------+
| ' 0 [ Init]: Start at 25 ' |
| ' 1 [ Null]: R1 = NULL' |
| ' 2 [ OpenRead]: Open read cursor [2] on index "COMDB2_PK" of table "sbtest1" (covering index) (cmnt:$COMDB2_PK_7C917175)' |
| ' 3 [ColumnsUsed]: Cursor [2] using column mask 1000000000000000000000000000000000000000000000000000000000000000' |
| ' 4 [ Explain]: No-op (168)' |
| ' 5 [ Integer]: R7 = 1' |
| ' 6 [ SeekGE]: Move cursor [2] to smallest entry >= R7. If no such records exist, go to 11' |
| ' 7 [ IdxGT]: Jump to 11 if cursor [2] > R7' |
| ' 8 [ IdxRowid]: R2 = Rowid of current entry at cursor [2]' |
| ' 9 [ RowSetAdd]: Insert R2 into boolean index in R1' |
| ' 10 [ Next]: Move cursor [2] to next entry. If entry exists, go to 7' |
| ' 11 [ Close]: Close cursor [2]' |
| ' 12 [ OpenWrite]: Open write cursor [0] on table "sbtest1" (cmnt:sbtest1)' |
| ' 13 [ RowSetRead]: R2 = Smallest from boolean index in R1. Jump to 23 if empty' |
| ' 14 [ NotExists]: If record id in R2 can''t be found using cursor [0], go to 13' |
| ' 15 [ Column]: R3 = "id" from cursor [0] on table "sbtest1" (cmnt:sbtest1.id)' |
| ' 16 [ Column]: R8 = "k" from cursor [0] on table "sbtest1" (cmnt:sbtest1.k)' |
| ' 17 [ Add]: R4 = R8 + R9' |
| ' 18 [ Column]: R5 = "c" from cursor [0] on table "sbtest1" (cmnt:sbtest1.c)' |
| ' 19 [ Column]: R6 = "pad" from cursor [0] on table "sbtest1" (cmnt:sbtest1.pad)' |
| ' 20 [ MakeRecord]: R10 = R3..R6' |
| ' 21 [ Insert]: Write record in R10 into table "sbtest1" using cursor [0]' |
| ' 22 [ Goto]: Go to 13' |
| ' 23 [ Close]: Close cursor [0]' |
| ' 24 [ Halt]: Stop' |
| ' 25 [Transaction]: Start a write transaction (cmnt:usesStmtJournal=0)' |
| ' 26 [ Integer]: R9 = 1' |
| ' 27 [ Goto]: Go to 1' |
+-------------------------------------------------------------------------------------------------------------------------------+
[update sbtest1 set k=k+1 where id=1] rc 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment