-1
我sql查询我的头文件,使主页只需要太多的时间。MySQL查询需要太多的时间来执行
"select
t1.*,t2.ID,t2.post_title,t2.post_content,t5.name as itemCat,t4.taxonomy as itemType
from
$wpdb->postmeta as t1
inner join $wpdb->posts as t2 on t2.ID=t1.post_id
inner join $wpdb->term_relationships as t3 on t3.object_id=t2.ID
inner join $wpdb->term_taxonomy as t4 on t4.term_taxonomy_id=t3.term_taxonomy_id
inner join $wpdb->terms as t5 on t5.term_id=t4.term_id
where t2.post_status='publish' AND t1.meta_key = '_ait-dir-item' and t1.meta_value
LIKE '%".$url->cityName."%' group by t2.ID,itemType"
使用的任何索引? – Neels
如何制作索引? – User1988
“%anything”不能使用索引。但“任何%”都可以。 – Strawberry