ok,so I digged into wp-includes/query.php,and found this on line 3180:
if ( is_user_logged_in() ) {
// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
$private_states = get_post_stati( array('private' => true) );
foreach ( (array) $private_states as $state )
$where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status="$state"" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status="$state"";
}
So this is the trigger and I can solve the performance problem by commenting the foreach.
But my question remains:why wordpress do this and what’s the purpose?
We are talk about a huge site here (with more than 40k posts).