# TABLE LOOKUP TABLE LOOKUP 算子用于表示全局索引的回表逻辑。 示例:全局索引回表 ~~~ obclient>CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT, c3 INT) PARTITION BY HASH(c1) PARTITIONS 4; Query OK, 0 rows affected (0.12 sec) obclient>CREATE INDEX i1 ON t1(c2) GLOBAL; Query OK, 0 rows affected (0.12 sec) obclient>EXPLAIN SELECT * FROM t1 WHERE c2 = 1\G; *************************** 1. row *************************** Query Plan: | ======================================== |ID|OPERATOR |NAME |EST. ROWS|COST | ---------------------------------------- |0 |TABLE LOOKUP|t1 |3960 |31065| |1 | TABLE SCAN |t1(i1)|3960 |956 | ======================================== Outputs & filters: ------------------------------------- 0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), partitions(p[0-3]) 1 - output([t1.c1]), filter(nil), access([t1.c1]), partitions(p0) ~~~ 上述示例中,1 号算子是扫描全局索引 i1, 0 号算子表明从主表中获取不在全局索引的列。执行计划展示中的 outputs & filters 详细展示了 TABLE LOOKUP 算子的输出信息如下: <table data-tag="table" id="table-9vv-vcr-p1h" class="table"><colgroup width="240" span="1" data-tag="col" id="col-72h-toe-pzy" colwidth="1*" colnum="1" colname="col1" style="width:50%" class="col"></colgroup><colgroup width="505" span="1" data-tag="col" id="col-ync-w7k-iz2" colwidth="1*" colnum="2" colname="col2" style="width:50%" class="col"></colgroup><thead id="thead-kkg-c3p-njw" class="thead"><tr id="tr-0ql-4ux-c7n"><th id="td-ffj-pid-1rf"><p id="p-45a-cjg-xc5"><b>信息名称</b></p></th><th id="td-aue-9il-tvl"><p id="p-2lo-8u2-5bm"><b>含义</b></p></th></tr></thead><tbody data-tag="tbody" id="tbody-ic0-93i-1gy" class="tbody"><tr data-tag="tr" id="tr-4kg-8rn-tv3" class="tr"><td data-tag="td" id="td-wol-h7h-i8j" class="td"><p data-tag="p" id="p-fes-k1q-929" class="p">output </p></td><td data-tag="td" id="td-7v8-rl7-x0w" class="td"><p id="p-zv5-wrj-hgl">该算子的输出列。</p></td></tr><tr data-tag="tr" id="tr-trh-5ua-hup" class="tr"><td id="td-eun-1hz-pet"><p id="p-2js-6d1-ot0">filter</p></td><td id="td-o2v-b0b-0lj"><p id="p-mi6-vw6-y17">该算子的过滤谓词。</p><p id="p-dri-jw0-s9e">由于示例中 TABLE LOOKUP 算子没有设置 filter,所以为 nil。</p></td></tr><tr data-tag="tr" id="tr-7l4-n5f-j90" class="tr"><td data-tag="td" id="td-rt5-4ta-p9z" class="td"><p data-tag="p" id="p-bqy-nq6-8ed" class="p">partitions</p></td><td data-tag="td" id="td-yi8-92h-al3" class="td"><p id="p-lfb-o06-95s">查询需要扫描的分区。</p></td></tr></tbody></table>