title: Improve Linq Perfomance with Join
body: <p>I have a Linq and its taking time so long like 2-3 minutes to get 8000 data.
  is there anybody can help me to improve my Linq for this process.</p>
  
  <pre><code>var listOP = (from f in db.T_COLLECT_OP_DTL.Where
                                  (x =&gt; x.PRODUCTION_DATE == prodDate &amp;&amp; (x.SHIFT == shifts || x.SHIFT == shift))
                        from g in db.T_COLLECT_OP_DTL_KIMPER.Where
                                  (x =&gt; x.PTDHCARD_ID == f.PTDHCARD_ID &amp;&amp;
                                  (x.PRODUCTION_DATE == f.PRODUCTION_DATE) &amp;&amp;
                                  (x.SHIFT == f.SHIFT) &amp;&amp;
                                   x.KIMPER_ID ==
                                   db.T_COLLECT_OP_DTL_KIMPER.Where
                                  (y =&gt; y.PTDHCARD_ID == x.PTDHCARD_ID &amp;&amp; y.MODEL == x.MODEL &amp;&amp;
                                   y.PRODUCTION_DATE == x.PRODUCTION_DATE &amp;&amp;
                                   y.SHIFT == x.SHIFT)
                                   .Max(y =&gt; y.KIMPER_ID)) 
                        from ii in db.T_SETUP_UNIT.Where
                                  (x =&gt; x.PRODUCTION_DATE == fsu &amp;&amp; (x.SHIFT == fsh) &amp;&amp; x.CURRENT_DELAY != "Breakdown")
                        join h in db.M_PRODUCT_MODEL on g.MODEL equals h.MODEL_CODE
                        from i in db.M_EQUIPMENT.Where
                        (x =&gt; x.EQUIPMENT_ID == ii.EQUIPMENT_ID &amp;&amp; x.PRODUCT_MODEL_ID == h.PRODUCT_MODEL_ID)
                        select new
                        {
                            f.OPERATOR_ID,
                            f.PRODUCTION_DATE,
                            f.SHIFT,
                            g.MODEL,
                            g.KIMPER_ID,
                            g.EXP_UNIT,
                            i.UNIT_NO
                        }).ToList();
  </code></pre>