How to speed up the following Linq Query for Stock
<p>I am write Programming in <strong>ASP.NET MVC</strong> with <strong>SQL Database</strong>. I want to get transfer list from database with between Date Range. Also the foreign key relationship with tables like product,Brand,sub-brand. <br><br>
Here i wrote the code for getting list but it take time to load.The Database have 3000 records per month.  how to optimize the code?</p>

<pre><code> var stockTransferDetails = db.StockTransferDetails.Where(s =&gt; s.BusinessUnitId == BusinessUnitId &amp;&amp;  (!string.IsNullOrEmpty(from) ? s.StockTransfer.TransferDate &gt;= FromDate : true) &amp;&amp; (!string.IsNullOrEmpty(to) ? s.StockTransfer.TransferDate &lt;= ToDate : true)).ToList();
            var stocksummary = from STD in stockTransferDetails.GroupBy(f =&gt; f.ProductId).ToList()
                               select new
                               {
                                   BrandName = STD.FirstOrDefault().Product.Brand.BrandName + STD.Where(m =&gt; !m.Product.SubBrand.BrandName.Equals("DEF")).Select(s =&gt; " - " + s.Product.SubBrand.BrandName).FirstOrDefault(),
                                   ProductName = STD.FirstOrDefault().Product.ProductName,
                                   Packsize = STD.FirstOrDefault().Product.Packsize + " " + STD.FirstOrDefault().Product.UOM.PickListValue,
                                   // TotalQty = (double?)STD.Sum(s =&gt; s.ReceievedQty)
                                   Cost = STD.FirstOrDefault().Product.Cost,
                                   TotalCost = (STD.Sum(s =&gt; s.ReceievedQty) * STD.FirstOrDefault().Product.Cost)
                               };
            OutletSTIn.Value = stocksummary.ToList();
</code></pre>