Меню сайта |
|
Форма входа |
|
Категории раздела |
|
Поиск |
|
Статистика |
Онлайн всего: 1 Гостей: 1 Пользователей: 0 |
|
Приветствую Вас, Гость · RSS |
19.05.2024, 23:12 |
|
A trick with rownum
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:32812348052#2030256639041
When we have a query with subqueries like this:
select t1.a from (select a from table1 where b between 1 and 10) t1, (select a from table2 where b between 1 and 10) t2 where t1.a = t2.a
and a is indexed, oracle with high probability will perform nested loops for the tables. But if selectivity of the filters is high, then more effective way to join the tables is hash join. To force hash join we could add rownum to each of the subqueries effectively materializing them:
select t1.a from (select a, rownum from table1 where b between 1 and 10) t1, (select a, rownum from table2 where b between 1 and 10) t2 where t1.a = t2.a
|
Категория: Oracle DB programming | Добавил: basil (18.11.2013)
|
Просмотров: 430 | Комментарии: 3
| Рейтинг: 0.0/0 |
|
|