sql - Advantage Database LEFT JOIN very slow -


sorry english

i have following query joins 2 tables

select t1.cod1, t2.xcod xcod1, t1.cod2, t2.xcod xcod2, t1.cod3, t2.xcod xcod3

from table1 t1
left join table2 t2 on t1.cod1 = t2.cod left join table2 t3 on t1.cod2 = t3.cod left join table2 t4 on t1.cod3 = t4.cod

the query returns joined tables correctly , query runs slowly

actually tables have more 200,000 records

i think doing right through sub queries or left join (select ..)...

any idea thanks..

                   table1                            table2       +---------+-------- +---------+             +-----+-----+       |  cod1   |   cod2  |   cod3  |             | cod | xcod|       +---------+------ --+---------+             +-----+-----+       |       |         |    f    |             |   |  1  |       |    d    |    b    |         |             |  b  |  2  |       |    c    |         |         |             |  c  |  3  |       |    f    |       |    d    |             |  d  |  4  |        +---------+---------+---------+             +-----+-----+          result:        +---------+-------- +---------+---------+---------+---------+       |  cod1   |  xcod1  |   cod2  |  xcod2  |  cod3   |  xcod3  |       +---------+---------+---------+---------+---------+---------+       |       |    1    |         |         |    f    |         |       |    d    |    4    |    b    |    2    |         |         |       |    c    |    3    |         |         |         |         |       |    f    |         |       |    1    |    d    |    4    |       +---------+---------+---------+---------+---------+---------+              


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -