# Try To Avoid Full Table Scan

__*Avoiding Table Full Scan*__

+ Replace OR with IN/UNION, and note that the number of object in the IN operation should be less than 300
+ Avoid ambiguous prefix query with the**%** prefix
+ **TRUNCATE** is recommended when deleting full table data

------------------------------------------------------------
- Do not perform mathematical operations or function operations on indexed columns in WHERE conditions;

- Replace or with in/union, and note that the number of object in the in operation should be less than 300;

- Avoid using the% prefix for ambiguous prefix query;

- If an application executes SQL using Multi Execution, that is, multiple SQL is connected using a semicolon and sent to the client for execution at once, TiDB return only the execution result of the first SQL.

- When deleting all the data in the table, it is recommended to use TRUNCATE or RECREATE (DROP then CREATE, or DROP/TRUNCATE PARTITION in a partitioned table, or a loop with a condition DELETE where condition.. limit N way. DELETE, TRUNCATE, and DROP do not immediately free up space. For TRUNCATE and DROP operations, after the GC (garbage collection) time of TiDB is reached (the default is 10 minutes. , TiDB's GC mechanism deletes data and frees up space. The GC mechanism for the DELETE operation TiDB deletes the data, but does not release the space, but reuses the space when subsequent data is written to RocksDB and compacted.