Closed jussisaurio closed 2 months ago
Similar to what SQLite does.
limbo> EXPLAIN SELECT u.age, p.name FROM users u LEFT JOIN products p ON u.first_name = p.name; addr opcode p1 p2 p3 p4 p5 comment ---- ----------------- ---- ---- ---- ------------- -- ------- 0 Init 0 25 0 0 Start at 25 1 OpenReadAsync 0 2 0 0 table=u, root=2 2 OpenReadAwait 0 0 0 0 3 OpenReadAsync 1 3 0 0 table=p, root=3 4 OpenReadAwait 0 0 0 0 5 RewindAsync 0 0 0 0 6 RewindAwait 0 -5 0 0 Rewind table u 7 Integer 0 1 0 0 r[1]=0; init LEFT JOIN match flag 8 RewindAsync 1 0 0 0 9 RewindAwait 1 -11 0 0 Rewind table p 10 Column 0 1 2 0 r[2]=u.first_name 11 Column 1 1 3 0 r[3]=p.name 12 Ne 2 3 17 0 if r[2]!=r[3] goto 17 13 Integer 1 1 0 0 r[1]=1; record LEFT JOIN hit 14 Column 0 9 4 0 r[4]=u.age 15 Column 1 1 5 0 r[5]=p.name 16 ResultRow 4 2 0 0 output=r[4..5] 17 NextAsync 1 0 0 0 18 NextAwait 1 9 0 0 19 IfPos 1 22 0 0 r[1]>0 -> r[1]-=0, goto 22 20 NullRow 1 0 0 0 Set cursor 1 to a (pseudo) NULL row 21 Goto 0 13 0 0 22 NextAsync 0 0 0 0 23 NextAwait 0 6 0 0 24 Halt 0 0 0 0 25 Transaction 0 0 0 0 26 Goto 0 1 0 0
Similar to what SQLite does.