提高Wordpress分类/ CPT查询的速度

时间:2015-03-05 11:37:25

标签: sql wordpress optimization

他们是一个更好的方法来重写这个Wordpress查询,以提高效率吗?特别是加入和发布元查找

SELECT 
    wp_posts.*
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_posts.post_type = 'logofall'
        AND ((wp_posts.post_status = 'publish'))
        AND ((wp_postmeta.meta_key = 'criteria_id'
        AND CAST(wp_postmeta.meta_value AS CHAR) IN (1913 , 1909, 1910, 1912, 1911))
        AND (mt1.meta_key = 'student_id'
        AND CAST(mt1.meta_value AS CHAR) = '999')
        AND (mt2.meta_key = 'skill_id'
        AND CAST(mt2.meta_value AS CHAR) <> ''))

0 个答案:

没有答案