我的数据库中有100000条记录,执行了很多元查询,所以执行操作需要很多时间,如何加快速度?
加载此查询需要20到25秒。
SELECT wp_posts.ID
FROM wp_posts
INNER JOIN wp_postmeta
ON ( wp_posts.ID = wp_postmeta.post_id )
INNER JOIN wp_postmeta AS mt1
ON ( wp_posts.ID = mt1.post_id )
INNER JOIN wp_postmeta AS mt2
ON ( wp_posts.ID = mt2.post_id )
WHERE 1=1
AND ( ( ( wp_postmeta.meta_key = \'profe\'
AND wp_postmeta.meta_value = \'magic\' )
AND ( mt1.meta_key = \'country\'
AND mt1.meta_value IN (\'uae\',\'uk\',\'usa\') )
AND ( mt2.meta_key = \'chargesof\' ) ) )
AND wp_posts.post_type = \'magicposts\'
AND ((wp_posts.post_status = \'publish\'))
GROUP BY wp_posts.ID
ORDER BY CAST(mt2.meta_value AS SIGNED) ASC
LIMIT 0, 12