get_posts()
uses the WP_Query
class to fetch posts.
Usually, it returns an array of post objects. The $fields
parameter for WP_Query
accepts two valid arguments: 'ids'
will make it return an array of post IDs and 'id=>parent'
will make it return an associative array with the post objects properties as key => value
pairs. Any other input value as an argument for $fields
will result in the objects being returned.
So either you gather the IDs only, or you will get $post_content
(and all other not needed info) back as well, either as an array item or an object property.
Generally, this ought not to be a performance issue though. It might be noticeable, if the resulting array itself is very large as well and you want to use it in further operations.
If your DB is so large, that optimized queries are required, consider that it still has to go through the entire wp_posts table, whether post content is actually selected or not.
Bottom line: It shouldn't matter at all, that the objects have some properties you do not need.