![]() So your indexes would be like this: CREATE INDEX ix2 ON T2 (id,date) īut there still remains a problem with the join between t4 and t5. (SELECT MIN(date) FROM t2 WHERE t2.id = t1.id) AS first_exp_dateįor better performace create indexes on (id, date) or (p_id, date). (SELECT MAX(date) FROM t3 WHERE t3.id = t1.id) AS last_publ_date, (SELECT MIN(date) FROM t3 WHERE t3.id = t1.id) AS first_pub_date, ![]() (SELECT MIN(t5.date) FROM t5 JOIN t4 ON t5.p_id = t4.p_id WHERE t4.id = t1.id) AS first_pri_date, I would write the query rather like this: SELECT t1.id, With good use of indexes you should be able to calculate MIN or MAX very quickly. Also indexes cannot be used this way to calculate MIN or MAX in the fastest possible way. I would say that your problem is that you are doing many LEFT JOINs and the final resultset gets too big after applying all those JOINs. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |