join absurd

Este forum é dedicado a códigos errados que se encontram por aí, ou seja, coisas que não se deve fazer de jeito nenhum! Não coloque neste forum dúvidas! (apenas situações bizarras do nosso dia a dia :-)
Post Reply
Diego_Mello
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 229
Joined: Fri, 05 Sep 2008 2:59 pm
Location: Igrejinha - RS
Diego Mello
Igrejinha - RS
www.twitter.com/diegolmello

Look at the n_ped_nmro parameter ...



This guy preferred to do 3 joins with the parameter than simply to do between the fields of the tables euehaiuehaiuehaiueha
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

There's an example I'vê seen a lot.
But I can not say if this practice is good or bad: -s

we would have to run the plan of execution of the two ways to compare ... I'll see if I can simulate this Here and put the results.
User avatar
alef
Rank: Analista Pleno
Rank: Analista Pleno
Posts: 119
Joined: Tue, 06 Nov 2007 2:45 pm
Location: Patos de Minas - MG
Alexandre Matos
Patos de Minas - MG
Do interior de Minas para o resto do Mundo

Theologian does not make a difference, because it would be the same thing as if he does the jewels between the tables, because the value of the PED_NMRO columns in the tables assume the same value. Of course if the guy would use other methods of jewels surely he would make a difference. CORRECE if I'm wrong.
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Oh yes, I think that in this case I would not make a difference.
My question is about the execution plan that might change, for Oracle can assume that the jewels end up returning 1 line at first join, perhaps more than one in the second, and many in the third ...: - /

I have already seen some cases (mainly in banks 8 or 8i) that the optimizer sometimes travels a lot!
NaPraia
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 88
Joined: Fri, 22 Feb 2008 8:24 am
Location: Floripa - SC

Not wanting to disagree but it makes it direction yes if you compare a parameter or field of the table.
mainly if the table is full that the query becomes heavy and the data table field and have index.
rodfbar
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 241
Joined: Tue, 09 Oct 2007 11:15 am
Location: Batatais - SP

Ola ...

(If Table As requested as request and ITE as of request items)

See if I am not mistaken
See this query The "PED" table has a restriction



In this case it could not happen to bring "ITE" items from which your requests are not are in these conditions, taking into consideration that in query the same do not have joins between you ??
Diego_Mello
Rank: DBA Júnior
Rank: DBA Júnior
Posts: 229
Joined: Fri, 05 Sep 2008 2:59 pm
Location: Igrejinha - RS
Diego Mello
Igrejinha - RS
www.twitter.com/diegolmello

face ...
I may be completely cheated, but ...
Since the two tables receive the same value for the n_ped_nmro variable ...
is like a Join between the tables ...
Example:

Select all

   p.ped_tipo IN ('PG', 'EX', 'PP')  
   AND p.ped_nmro = 101 
   AND q.ped_nmro = 101
This would be equal to this (v) ...

Select all

   p.ped_tipo IN ('PG', 'EX', 'PP')  
   AND p.ped_nmro = q.ped_nmro 
   AND q.ped_nmro = 101
But what Napraia said is very likely to be right ... 8)
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests