Optimization of the sample mysql

Tell me please rasenica in the speed of processing such a query:
SELECT wt.title, wt.url_title, wt.entry_date, wd.field_id_2 AS body,<br> IF(ft.thread_total, ft.thread_total, 0) AS thread_total<br> FROM exp_weblog_titles AS wt<br> LEFT JOIN exp_weblog_data AS wd ON wd.entry_id = wt.entry_id<br> LEFT JOIN exp_forum_topics AS ft ON ft.topic_id = wt.forum_topic_id<br> WHERE wt.weblog_id = 2<br>

Or faster way:
SELECT wt.title, wt.url_title, wt.entry_date, wd.field_id_2 AS body,<br> IF(ft.thread_total, ft.thread_total, 0) AS thread_total<br> FROM exp_weblog_titles AS wt, exp_weblog_data AS wd, AS ft exp_forum_topics<br> WHERE wt.weblog_id = 2 AND wd.entry_id = wt.entry_id AND ft.topic_id = wt.forum_topic_id<br>

Like the second one runs Ruano twice as fast. And what is the impact if lots of conditions to add.
I will be glad if you tell me what explanatory materials for optimizing sql
October 8th 19 at 03:02
3 answers
October 8th 19 at 03:04
The conditions in this case kosvenno impact on speed, You speed is affected by the type unification tables, the first LEFT JOIN second INNER JOIN. After reading about these types of connections You will learn the difference in speed and which option when preferred.
October 8th 19 at 03:06
Use EXPLAIN SELECT.
Will Google now) - Bradford_Balistrer commented on October 8th 19 at 03:09
I understand but go if exp_forum_topics no connection - Bradford_Balistrer commented on October 8th 19 at 03:12
October 8th 19 at 03:08
explain select and see whether the index in the sample,
But if not used? - Bradford_Balistrer commented on October 8th 19 at 03:11
make an index on these fields (CEP) - Bradford_Balistrer commented on October 8th 19 at 03:14

Find more questions by tags MySQL