title: Left outer join performace issues in postgresql
body: <p>How to improve the performance of query given below</p>
  
  <pre><code>select 
       distinct o1.id as c1, 
                a1.id as c2,
                o1.t1_id as c3, 
                o1.t2_id as c4,
                o1.t_p_id as c5 
  from 
       ord o1 
       left outer join 
       acc a1 
         on o1.end_user_id=a1.id 
       left outer join 
       acc a2 
         on 1.t1_id=a2.id 
       left outer join 
       acc a3 
         on o1.t2_id=a3.id 
       left outer join 
       acc a4 on 
         o1.t_p_id=account4_.id 
  where 
       a1.account_id=1 or a2.account_id=1 or a3.account_id=1 or a4.account_id=1;
  </code></pre>