# Suboptimal Sql Statement Execution Plan Index Analysis (Continue...)

+ Execute with a forced hint, reducing the execution time from 63 seconds to 6.3 seconds

```
mysql> select count(*)
    -> from tods.bus_jijin_trade_record a   use index(idx_bus_jijin_trade_record_upt), tods.bus_jijin_info b 
    -> where a.fund_code=b.fund_code  and a.type in ('PURCHASE','APPLY')  
    -> and a.status='CANCEL_SUCCESS' and   a.pay_confirm_status = 1 
    -> and a.cancel_app_no is not null and   a.id >=  177045000  
    -> and a.updated_at >   date_sub(now(), interval 48 hour) ;
+----------+
| count(*) |
+----------+
|      709 |
+----------+
1 row in set (6.27 sec)
```

------------------------------------------------------------
```
mysql> select count(*)
    -> from tods.bus_jijin_trade_record a   use index(idx_bus_jijin_trade_record_upt), tods.bus_jijin_info b 
    -> where a.fund_code=b.fund_code  and a.type in ('PURCHASE','APPLY')  
    -> and a.status='CANCEL_SUCCESS' and   a.pay_confirm_status = 1 
    -> and a.cancel_app_no is not null and   a.id >=  177045000  
    -> and a.updated_at >   date_sub(now(), interval 48 hour) ;
+----------+
| count(*) |
+----------+
|      709 |
+----------+
1 row in set (6.27 sec)
```

Query the data partition according to the above two conditions separately. We can see that with the last predicate condition id >= 177045000, there are about 140 million records. There are relatively few records filtered by updated_at > date_sub (now (), interval 48 hour), with only 700,000 records. At this point, the table bus_jijin_trade_record has 170 million data volumes and should be indexed on the updated_at field.
We can consider enforcing indexing. Execution with a forced hint is completed in 6.27 seconds, and the speed is 10 times higher than the previous 63s to the current 6.3s.
