graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:3px,color:#000
    classDef itemplan fill:#fff,stroke-width:6px,color:#000
    classDef sideeffectplan fill:#f00,stroke-width:6px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:6px,text-align:left


    %% define plans
    __Value0["__Value[0∈0]"]:::plan
    __Value3["__Value[3∈0]<br />ᐸcontextᐳ"]:::plan
    __InputStaticLeaf7["__InputStaticLeaf[7∈0]"]:::plan
    __InputStaticLeaf8["__InputStaticLeaf[8∈0]"]:::plan
    __InputStaticLeaf9["__InputStaticLeaf[9∈0]"]:::plan
    Access95["Access[95∈0]<br />ᐸ3.pgSettingsᐳ"]:::plan
    Access96["Access[96∈0]<br />ᐸ3.withPgClientᐳ"]:::plan
    Object97["Object[97∈0]<br />ᐸ{pgSettings,withPgClient}ᐳ"]:::plan
    Connection25["Connection[25∈0]<br />ᐸ21ᐳ"]:::plan
    PgSelect26[["PgSelect[26∈0]<br />ᐸpostᐳ"]]:::plan
    __Item27>"__Item[27∈1]<br />ᐸ26ᐳ"]:::itemplan
    PgSelectSingle28["PgSelectSingle[28∈1]<br />ᐸpostᐳ"]:::plan
    PgClassExpression30["PgClassExpression[30∈1]<br />ᐸ__post__.”id”ᐳ"]:::plan
    List31["List[31∈1]<br />ᐸ30ᐳ"]:::plan
    PgCursor29["PgCursor[29∈1]"]:::plan
    PgClassExpression33["PgClassExpression[33∈1]<br />ᐸ__post__.”headline”ᐳ"]:::plan
    PgClassExpression37["PgClassExpression[37∈1]<br />ᐸ”a”.”post_...(__post__)ᐳ"]:::plan
    Map126["Map[126∈1]<br />ᐸ28:{”0”:3,”1”:4,”2”:5,”3”:6,”4”:7,”5”:8,”6”:9,”7”:10,”8”:11,”9”:12,”10”:13}ᐳ"]:::plan
    PgSelectSingle44["PgSelectSingle[44∈1]<br />ᐸpersonᐳ"]:::plan
    PgClassExpression45["PgClassExpression[45∈1]<br />ᐸ__person__.”id”ᐳ"]:::plan
    PgClassExpression46["PgClassExpression[46∈1]<br />ᐸ__person__...full_name”ᐳ"]:::plan
    PgClassExpression48["PgClassExpression[48∈1]<br />ᐸ”c”.”perso..._person__)ᐳ"]:::plan
    Map122["Map[122∈1]<br />ᐸ44:{”0”:2,”1”:3,”2”:4,”3”:5,”4”:6,”5”:7}ᐳ"]:::plan
    PgSelectSingle55["PgSelectSingle[55∈1]<br />ᐸperson_first_postᐳ"]:::plan
    PgClassExpression56["PgClassExpression[56∈1]<br />ᐸ__person_f...ost__.”id”ᐳ"]:::plan
    PgClassExpression57["PgClassExpression[57∈1]<br />ᐸ__person_f...”headline”ᐳ"]:::plan
    PgClassExpression61["PgClassExpression[61∈1]<br />ᐸ”a”.”post_...st_post__)ᐳ"]:::plan
    Map120["Map[120∈1]<br />ᐸ55:{”0”:3,”1”:4,”2”:5}ᐳ"]:::plan
    PgSelectSingle68["PgSelectSingle[68∈1]<br />ᐸpersonᐳ"]:::plan
    PgClassExpression69["PgClassExpression[69∈1]<br />ᐸ__person__.”id”ᐳ"]:::plan
    PgClassExpression70["PgClassExpression[70∈1]<br />ᐸ__person__...full_name”ᐳ"]:::plan
    PgClassExpression72["PgClassExpression[72∈1]<br />ᐸ”c”.”perso..._person__)ᐳ"]:::plan
    __InputStaticLeaf73["__InputStaticLeaf[73∈0]"]:::plan
    __InputStaticLeaf74["__InputStaticLeaf[74∈0]"]:::plan
    __InputStaticLeaf75["__InputStaticLeaf[75∈0]"]:::plan
    Connection98["Connection[98∈0]<br />ᐸ94ᐳ"]:::plan
    Access124["Access[124∈1]<br />ᐸ126.8ᐳ"]:::plan
    __ListTransform100["__ListTransform[100∈1]<br />ᐸeach:99ᐳ"]:::plan
    __Item101>"__Item[101∈2]<br />ᐸ124ᐳ"]:::itemplan
    PgSelectSingle102["PgSelectSingle[102∈2]<br />ᐸperson_friendsᐳ"]:::plan
    __Item103>"__Item[103∈3]<br />ᐸ100ᐳ"]:::itemplan
    PgSelectSingle104["PgSelectSingle[104∈3]<br />ᐸperson_friendsᐳ"]:::plan
    PgClassExpression105["PgClassExpression[105∈3]<br />ᐸ__person_friends__.”id”ᐳ"]:::plan
    PgClassExpression106["PgClassExpression[106∈3]<br />ᐸ__person_f...full_name”ᐳ"]:::plan
    PgClassExpression108["PgClassExpression[108∈3]<br />ᐸ”c”.”perso...friends__)ᐳ"]:::plan
    Access125["Access[125∈1]<br />ᐸ126.9ᐳ"]:::plan
    First110["First[110∈1]"]:::plan
    PgSelectSingle111["PgSelectSingle[111∈1]<br />ᐸperson_friendsᐳ"]:::plan
    PgClassExpression112["PgClassExpression[112∈1]<br />ᐸcount(*)ᐳ"]:::plan
    PgPageInfo113["PgPageInfo[113∈0]"]:::plan
    First115["First[115∈1]"]:::plan
    PgSelectSingle116["PgSelectSingle[116∈1]<br />ᐸperson_friendsᐳ"]:::plan
    PgClassExpression118["PgClassExpression[118∈1]<br />ᐸrow_number...tion by 1)ᐳ"]:::plan
    List119["List[119∈1]<br />ᐸ118ᐳ"]:::plan
    PgCursor117["PgCursor[117∈1]"]:::plan

    %% plan dependencies
    __Value3 --> Access95
    __Value3 --> Access96
    Access95 & Access96 --> Object97
    __InputStaticLeaf7 & __InputStaticLeaf8 & __InputStaticLeaf9 --> Connection25
    Object97 & Connection25 --> PgSelect26
    PgSelect26 ==> __Item27
    __Item27 --> PgSelectSingle28
    PgSelectSingle28 --> PgClassExpression30
    PgClassExpression30 --> List31
    List31 --> PgCursor29
    PgSelectSingle28 --> PgClassExpression33
    PgSelectSingle28 --> PgClassExpression37
    PgSelectSingle28 --> Map126
    Map126 --> PgSelectSingle44
    PgSelectSingle44 --> PgClassExpression45
    PgSelectSingle44 --> PgClassExpression46
    PgSelectSingle44 --> PgClassExpression48
    PgSelectSingle44 --> Map122
    Map122 --> PgSelectSingle55
    PgSelectSingle55 --> PgClassExpression56
    PgSelectSingle55 --> PgClassExpression57
    PgSelectSingle55 --> PgClassExpression61
    PgSelectSingle55 --> Map120
    Map120 --> PgSelectSingle68
    PgSelectSingle68 --> PgClassExpression69
    PgSelectSingle68 --> PgClassExpression70
    PgSelectSingle68 --> PgClassExpression72
    __InputStaticLeaf73 & __InputStaticLeaf74 & __InputStaticLeaf75 --> Connection98
    Map126 --> Access124
    Access124 --> __ListTransform100
    PgSelectSingle102 -.-> __ListTransform100
    Access124 -.-> __Item101
    __Item101 --> PgSelectSingle102
    __ListTransform100 ==> __Item103
    __Item103 --> PgSelectSingle104
    PgSelectSingle104 --> PgClassExpression105
    PgSelectSingle104 --> PgClassExpression106
    PgSelectSingle104 --> PgClassExpression108
    Map126 --> Access125
    Access125 --> First110
    First110 --> PgSelectSingle111
    PgSelectSingle111 --> PgClassExpression112
    Access124 --> First115
    First115 --> PgSelectSingle116
    PgSelectSingle116 --> PgClassExpression118
    PgClassExpression118 --> List119
    List119 --> PgCursor117

    %% plan-to-path relationships
    P0["~"]
    __Value0 -.-> P0
    P25["ᐳallPosts"]
    Connection25 -.-> P25
    P26["ᐳa…sᐳedges"]
    PgSelect26 -.-> P26
    P28["ᐳa…sᐳedges[]<br />ᐳa…sᐳe…]ᐳnode"]
    PgSelectSingle28 -.-> P28
    P29["ᐳa…sᐳe…]ᐳcursor"]
    PgCursor29 -.-> P29
    P30["ᐳa…sᐳe…]ᐳnodeᐳid"]
    PgClassExpression30 -.-> P30
    P33["ᐳa…sᐳe…]ᐳnodeᐳheadline"]
    PgClassExpression33 -.-> P33
    P37["ᐳa…sᐳe…]ᐳnodeᐳheadlineTrimmed"]
    PgClassExpression37 -.-> P37
    P44["ᐳa…sᐳe…]ᐳnodeᐳauthor"]
    PgSelectSingle44 -.-> P44
    P45["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳid"]
    PgClassExpression45 -.-> P45
    P46["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳname"]
    PgClassExpression46 -.-> P46
    P48["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳfirstName"]
    PgClassExpression48 -.-> P48
    P55["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳfirstPost"]
    PgSelectSingle55 -.-> P55
    P56["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳid"]
    PgClassExpression56 -.-> P56
    P57["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳheadline"]
    PgClassExpression57 -.-> P57
    P61["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳheadlineTrimmed"]
    PgClassExpression61 -.-> P61
    P68["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳauthor"]
    PgSelectSingle68 -.-> P68
    P69["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳa…rᐳid"]
    PgClassExpression69 -.-> P69
    P70["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳa…rᐳname"]
    PgClassExpression70 -.-> P70
    P72["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…tᐳa…rᐳfirstName"]
    PgClassExpression72 -.-> P72
    P98["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳfriends"]
    Connection98 -.-> P98
    P100["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳnodes"]
    __ListTransform100 -.-> P100
    P102["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳnodes@100[]"]
    PgSelectSingle102 -.-> P102
    P104["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳnodes[]"]
    PgSelectSingle104 -.-> P104
    P105["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳn…]ᐳid"]
    PgClassExpression105 -.-> P105
    P106["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳn…]ᐳname"]
    PgClassExpression106 -.-> P106
    P108["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳn…]ᐳfirstName"]
    PgClassExpression108 -.-> P108
    P112["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳtotalCount"]
    PgClassExpression112 -.-> P112
    P113["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳpageInfo"]
    PgPageInfo113 -.-> P113
    P117["ᐳa…sᐳe…]ᐳnodeᐳa…rᐳf…sᐳp…oᐳstartCursor"]
    PgCursor117 -.-> P117

    subgraph "Buckets for queries/v4/posts"
    Bucket0("Bucket 0 (root)<br />~<br />⠀ROOT ᐸ-O- 0<br />⠀⠀allPosts ᐸ-O- 25<br />⠀⠀⠀allPosts.edges ᐸ-A- 26"):::bucket
    classDef bucket0 stroke:#696969
    class Bucket0,__Value0,__Value3,__InputStaticLeaf7,__InputStaticLeaf8,__InputStaticLeaf9,Connection25,PgSelect26,__InputStaticLeaf73,__InputStaticLeaf74,__InputStaticLeaf75,Access95,Access96,Object97,Connection98,PgPageInfo113 bucket0
    Bucket1("Bucket 1 (item27)<br />Deps: 26, 98, 113<br />~ᐳQuery.allPostsᐳPostsConnection.edges[]<br />⠀ROOT ᐸ-O- 28<br />⠀⠀node ᐸ-O- 28<br />⠀⠀⠀node.id ᐸ-L- 30<br />⠀⠀⠀node.headline ᐸ-L- 33<br />⠀⠀⠀node.headlineTrimmed ᐸ-L- 37<br />⠀⠀⠀node.author ᐸ-O- 44<br />⠀⠀⠀⠀node.author.id ᐸ-L- 45<br />⠀⠀⠀⠀node.author.name ᐸ-L- 46<br />⠀⠀⠀⠀node.author.firstName ᐸ-L- 48<br />⠀⠀⠀⠀node.author.firstPost ᐸ-O- 55<br />⠀⠀⠀⠀⠀node.author.firstPost.id ᐸ-L- 56<br />⠀⠀⠀⠀⠀node.author.firstPost.headline ᐸ-L- 57<br />⠀⠀⠀⠀⠀node.author.firstPost.headlineTrimmed ᐸ-L- 61<br />⠀⠀⠀⠀⠀node.author.firstPost.author ᐸ-O- 68<br />⠀⠀⠀⠀⠀⠀node.author.firstPost.author.id ᐸ-L- 69<br />⠀⠀⠀⠀⠀⠀node.author.firstPost.author.name ᐸ-L- 70<br />⠀⠀⠀⠀⠀⠀node.author.firstPost.author.firstName ᐸ-L- 72<br />⠀⠀⠀⠀node.author.friends ᐸ-O- 98<br />⠀⠀⠀⠀⠀node.author.friends.nodes ᐸ-A- 100<br />⠀⠀⠀⠀⠀node.author.friends.totalCount ᐸ-L- 112<br />⠀⠀⠀⠀⠀node.author.friends.pageInfo ᐸ-O- 113<br />⠀⠀⠀⠀⠀⠀node.author.friends.pageInfo.startCursor ᐸ-L- 117<br />⠀⠀cursor ᐸ-L- 29"):::bucket
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item27,PgSelectSingle28,PgCursor29,PgClassExpression30,List31,PgClassExpression33,PgClassExpression37,PgSelectSingle44,PgClassExpression45,PgClassExpression46,PgClassExpression48,PgSelectSingle55,PgClassExpression56,PgClassExpression57,PgClassExpression61,PgSelectSingle68,PgClassExpression69,PgClassExpression70,PgClassExpression72,__ListTransform100,First110,PgSelectSingle111,PgClassExpression112,First115,PgSelectSingle116,PgCursor117,PgClassExpression118,List119,Map120,Map122,Access124,Access125,Map126 bucket1
    Bucket2("Bucket 2 (item101)<br />Deps: 124"):::bucket
    classDef bucket2 stroke:#7f007f
    class Bucket2,__Item101,PgSelectSingle102 bucket2
    Bucket3("Bucket 3 (item103)<br />Deps: 100<br />~ᐳQuery.allPostsᐳPostsConnection.edges[]ᐳPostEdge.nodeᐳPost.authorᐳPerson.friendsᐳPeopleConnection.nodes[]<br />⠀ROOT ᐸ-O- 104<br />⠀⠀id ᐸ-L- 105<br />⠀⠀name ᐸ-L- 106<br />⠀⠀firstName ᐸ-L- 108"):::bucket
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item103,PgSelectSingle104,PgClassExpression105,PgClassExpression106,PgClassExpression108 bucket3
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2 & Bucket3
    end
