|
|
|
Разница в запросах. Один зависает, а другой нет.
|
|||
|---|---|---|---|
|
#18+
Привет. Вот нужно было селектануть из базы, написал запрос: Код: php 1. 2. 3. 4. 5. 6. 7. 8. 9. - выполняю, а он зависает. Написал по-другому запрос: Код: php 1. 2. 3. 4. 5. 6. 7. 8. 9. - выполнился быстро. Почему первый запрос зависает? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.09.2013, 22:44:47 |
|
||
|
Разница в запросах. Один зависает, а другой нет.
|
|||
|---|---|---|---|
|
#18+
Vladimit04, First of all check using join buffer clause: Using join buffer Tables from earlier joins are read in portions into the join buffer, and then their rows are used from the buffer to perform the join with the current table. Here is great article for this: http://s.petrunia.net/blog/?p=18 Second one the examined row count: From 1st query it will examine 23916+265195 rows, but 2nd query will examine 265195+1. Using Join Buffer indicates that 23916 rows(table b) firstly are reading to join buffer then for each of them MySQL performs join with "table a"...surely it must take long time than exact match and join (2nd query)... Also you can read about "unique_subquery" clause..it is kind of great optimization for IN subqueries: jointype_unique_subquery unique_subquery is just an index lookup function that replaces the subquery completely for better efficiency. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.09.2013, 23:28:02 |
|
||
|
|

start [/forum/topic.php?fid=47&fpage=207&tid=1835997]: |
0ms |
get settings: |
6ms |
get forum list: |
10ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
43ms |
get topic data: |
8ms |
get forum data: |
3ms |
get page messages: |
20ms |
get tp. blocked users: |
1ms |
| others: | 224ms |
| total: | 321ms |

| 0 / 0 |
