
```
[ SQL ] SELECT `post`.* FROM `cmf_portal_post` `post` INNER JOIN `cmf_portal_category_post` `relation` ON `post`.`id`=`relation`.`post_id` WHERE `post`.`post_type` = 1 AND `post`.`post_status` = 1 AND `relation`.`category_id` = 5 AND `relation`.`post_id` < 2 AND ( `post`.`published_time` < 1638691195 and `post`.`published_time` > 0 ) ORDER BY `published_time` DESC LIMIT 1 [ RunTime:0.003768s ]
```
```
[ EXPLAIN : array ( 'id' => '1', 'select_type' => 'SIMPLE', 'table' => 'post', 'partitions' => NULL, 'type' => 'range', 'possible_keys' => 'PRIMARY,type_status_date', 'key' => 'PRIMARY', 'key_len' => '8', 'ref' => NULL, 'rows' => '1', 'filtered' => '5.55', 'extra' => 'Using where; Using filesort', ) ]
```
当搜索结果数据为1时,运行时间0.003768s
```
[ SQL ] SELECT `post`.* FROM `cmf_portal_post` `post` INNER JOIN `cmf_portal_category_post` `relation` ON `post`.`id`=`relation`.`post_id` WHERE `post`.`post_type` = 1 AND `post`.`post_status` = 1 AND `post`.`delete_time` = 0 AND `relation`.`category_id` = 5 AND `relation`.`post_id` > 2 AND ( `post`.`published_time` < 1638691195 and `post`.`published_time` > 0 ) ORDER BY `published_time` ASC LIMIT 1 [ RunTime:0.332894s ]
```
```
[ EXPLAIN : array ( 'id' => '1', 'select_type' => 'SIMPLE', 'table' => 'relation', 'partitions' => NULL, 'type' => 'range', 'possible_keys' => 'post_id,term_taxonomy_id', 'key' => 'term_taxonomy_id', 'key_len' => '16', 'ref' => NULL, 'rows' => '11781', 'filtered' => '100.00', 'extra' => 'Using where; Using index; Using temporary; Using filesort', ) ]
```
当搜索结果数据为11781时,运行时间0.332894s,相差100倍