Skip to content

Instantly share code, notes, and snippets.

@nirbhayc
Created January 17, 2019 18:50
Show Gist options
  • Select an option

  • Save nirbhayc/be1578284bedd49f2434fa2745fb65fe to your computer and use it in GitHub Desktop.

Select an option

Save nirbhayc/be1578284bedd49f2434fa2745fb65fe to your computer and use it in GitHub Desktop.

Revisions

  1. nirbhayc created this gist Jan 17, 2019.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    nctdb> update sbtest1 set k=k+1 where id=1;
    +-------------------------------------------------------------------------------------------------------------------------------+
    | Plan |
    +-------------------------------------------------------------------------------------------------------------------------------+
    | ' 0 [ Init]: Start at 23 ' |
    | ' 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 (178)' |
    | ' 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 [ OpenWrite]: Open write cursor [0] on table "sbtest1" (cmnt:sbtest1)' |
    | ' 12 [ RowSetRead]: R2 = Smallest from boolean index in R1. Jump to 22 if empty' |
    | ' 13 [ NotExists]: If record id in R2 can''t be found using cursor [0], go to 12' |
    | ' 14 [ Column]: R3 = "id" from cursor [0] on table "sbtest1" (cmnt:sbtest1.id)' |
    | ' 15 [ Column]: R8 = "k" from cursor [0] on table "sbtest1" (cmnt:sbtest1.k)' |
    | ' 16 [ Add]: R4 = R8 + R9' |
    | ' 17 [ Column]: R5 = "c" from cursor [0] on table "sbtest1" (cmnt:sbtest1.c)' |
    | ' 18 [ Column]: R6 = "pad" from cursor [0] on table "sbtest1" (cmnt:sbtest1.pad)' |
    | ' 19 [ MakeRecord]: R8 = R3..R6' |
    | ' 20 [ Insert]: Write record in R8 into table "sbtest1" using cursor [0]' |
    | ' 21 [ Goto]: Go to 12' |
    | ' 22 [ Halt]: Stop' |
    | ' 23 [Transaction]: Start a write transaction (cmnt:usesStmtJournal=0)' |
    | ' 24 [ Integer]: R9 = 1' |
    | ' 25 [ Goto]: Go to 1' |
    +-------------------------------------------------------------------------------------------------------------------------------+
    [update sbtest1 set k=k+1 where id=1] rc 0