# Non-Clustered Index for Primary Key - `TableFullScan` Example
+ Why **`TableFullScan`** is used here?

```
tidb> SHOW CREATE TABLE universe.planets;
tidb> CREATE TABLE `planets` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  ...
  PRIMARY KEY (`id`) /*T![clustered_index] NONCLUSTERED */,
  ...

tidb> SELECT COUNT(*) FROM universe.planets
+----------+
| COUNT(*) |
+----------+
|       10 |
+----------+
1 row in set (0.01 sec)

tidb> EXPLAIN
  SELECT mass, gravity
  FROM universe.planets
  WHERE ~!@id BETWEEN 3 AND 8@!~;
+---------------------------+---------+-----------+---------------+--------------------------------------------------------+
| id                        | estRows | task      | access object | operator info                                          |
+---------------------------+---------+-----------+---------------+--------------------------------------------------------+
| Projection_4              | 6.00    | root      |               | universe.planets.mass, universe.planets.gravity        |
| └─TableReader_7           | 6.00    | root      |               | data:Selection_6                                       |
|   └─Selection_6           | 6.00    | cop[tikv] |               | ge(universe.planets.id, 3), le(universe.planets.id, 8) |
|     └─~!@TableFullScan@!~_5     | 10.00   | cop[tikv] | table:planets | keep order:false                                       |
+---------------------------+---------+-----------+---------------+--------------------------------------------------------+
```
![`smart`](NonClusteredTableWithPrimaryKey_en_001_20231116.png)

------------------------------------------------------------------------------
Why `FullTableScan` is used for the query on the slide? `TableFullScan` is not always an inefficient operation. In cases where your query is not selective, `TableFullScan` can be more efficient than an `IndexRangeScan` followed by multiple `Point_Get` operations.

In this case, the table `planets` contains only 10 rows, and since the selection covers 60% of its rows, the Cost Based Optimizer prefers a `TableFullScan` over an `IndexRangeScan`. In other words, `FullTableScan` is not considered a problem in this context. More information about the Cost Based Optimizer will be provided in later chapters.
