I've tried to figure it out why it is slow when I join 4 tables together by using Linq in C#. Furthermore, there are two the same tables wp_posts
. I would like to know if I could reduce that tables it might be faster. I am using MySQL.
var results = from a in _newsEntities.wp_posts
join b in _newsEntities.wp_postmeta
on a.ID equals b.post_id
join c in _newsEntities.wp_posts
on b.meta_value equals c.ID.ToString()
join d in _newsEntities.wp_users on a.post_author equals d.ID
where a.post_status == "publish" &&
a.post_type == "post" &&
b.meta_key == "reporter_name"
select new
{
Id = a.ID,
Status = a.post_status,
Content = a.post_content,
ReporterId = c.post_content,
ReporterName = c.post_title,
DateCreated = a.post_date,
DateModified = a.post_modified,
AuthorId = a.post_author,
AuthorName = d.display_name
};