The TABLE LOOKUP operator represents the logic of table access by global index primary key.
Example: table access by global index primary key
obclient> CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT, c3 INT) PARTITION BY
HASH(c1) PARTITIONS 4;
Query OK, 0 rows affected
obclient> CREATE INDEX i1 ON t1(c2) GLOBAL;
Query OK, 0 rows affected
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)
In the preceding example, the No. 1 operator executes the scanning of global index i1, and the No. 0 operator specifies to retrieve columns that are not in the global index from the primary table. The outputs & filters section in the execution plan display shows in detail the output information of the TABLE LOOKUP operator.
| Parameter | Description |
|---|---|
| output | The output columns of the operator. |
| filter | The filter predicates of the operator. In this example, filter is set to nil because no filter condition is configured for the TABLE LOOKUP operator. |
| partitions | The partitions to be scanned in the query. |