From http://stackoverflow.com/questions/14238215/how-to-optimize-my-query-exporting-wordpress-posts-with-category-and-tag-list?rq=1