<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Query Optimization</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Query Optimization</description>
  <pubDate>Tue, 12 May 2026 23:20:40 -700</pubDate>
  <lastBuildDate>Wed, 24 Oct 2012 10:53:35 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3708</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Query Optimization : Von,I was not able to reproduce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14957#14957</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 24-Oct-2012 at 10:53am<br /><br />Von,<div>&nbsp;</div><div>I was not able to reproduce the behavior you stated.</div><div>Here is my test solution: <a href="uploads/892/T12223_.zip" target="_blank">uploads/892/T12223_.zip</a></div><div>&nbsp;</div><div>Please provide a reproducible test case so we can further investigate this issue.</div><div>&nbsp;</div><div>Silvio.</div>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 10:53:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14957#14957</guid>
  </item> 
  <item>
   <title>Query Optimization :   Hi Von,I&amp;#039;m still working...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14954#14954</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 24-Oct-2012 at 8:53am<br /><br />Hi Von,<div>&nbsp;</div><div>I'm still working on reproducing the issue.</div>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 08:53:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14954#14954</guid>
  </item> 
  <item>
   <title>Query Optimization : Hi Silvio,Any update on this one?This...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14948#14948</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 23-Oct-2012 at 8:23pm<br /><br />Hi Silvio,<div><br></div><div>Any update on this one?</div><div>This is a critical issue in our part and we need to fix it as early as possible.</div><div><br></div><div>Thanks,</div><div>Von</div>]]>
   </description>
   <pubDate>Tue, 23 Oct 2012 20:23:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14948#14948</guid>
  </item> 
  <item>
   <title>Query Optimization :   Von,I&amp;#039;ll try to reproduce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14918#14918</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 19-Oct-2012 at 12:11pm<br /><br />Von,<div>&nbsp;</div><div>I'll try to reproduce the behavior here so we can further investigate.</div><div>&nbsp;</div><div>Silvio.</div>]]>
   </description>
   <pubDate>Fri, 19 Oct 2012 12:11:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14918#14918</guid>
  </item> 
  <item>
   <title>Query Optimization : Hi Silvio,We&amp;#039;re expecting...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14913#14913</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 18-Oct-2012 at 8:23pm<br /><br />Hi Silvio,<div><br></div><div>We're expecting a huge amount of records to query so querying it once will not work for us.<br><div><br></div><div>Async is not a choice either cause we're waiting for each page query to finish.</div><div><br></div><div>In your reply:</div><div><span style=": rgb251, 251, 253; ">In your for statement you are issuing a query against the datasource for each page. Since you are loading everything anyway, you my as well execute it against the data already loaded in the cache.</span></div><div><span style=": rgb251, 251, 253; "><br>Can you give me a detail on how to do this?</span></div><div><span style=": rgb251, 251, 253; "><br></span></div><div><span style=": rgb251, 251, 253; ">My concern is the delay w/c is incremented as the page index increments and it reach the point that it will time out.</span></div><div><span style=": rgb251, 251, 253; ">What do you think is the problem here?</span></div><div><br></div><div><span style=": rgb251, 251, 253; "><br></span></div><div><span style=": rgb251, 251, 253; ">Thanks,</span></div><div><span style=": rgb251, 251, 253; ">Von</span></div></div>]]>
   </description>
   <pubDate>Thu, 18 Oct 2012 20:23:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14913#14913</guid>
  </item> 
  <item>
   <title>Query Optimization :   Von,Have you tried executing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14855#14855</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 15-Oct-2012 at 9:59am<br /><br />Von,<div>&nbsp;</div><div>Have you tried executing the Query only once? i.e. customers.Execute() / stores.execute() - you might also execute them asynchronously.</div><div>&nbsp;</div><div>In your for statement you are issuing a query against the datasource for each page. Since you are loading everything anyway, you my as well execute it against the data already loaded in the cache. </div><div>&nbsp;</div><div>That might help.</div><div>&nbsp;</div><div>sbelini.</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Mon, 15 Oct 2012 09:59:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14855#14855</guid>
  </item> 
  <item>
   <title>Query Optimization : Hi Guys,Just want to follow up...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14851#14851</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 15-Oct-2012 at 3:46am<br /><br />Hi Guys,<div><br></div><div>Just want to follow up this..</div><div><br></div><div>Thanks,</div><div>Von</div>]]>
   </description>
   <pubDate>Mon, 15 Oct 2012 03:46:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14851#14851</guid>
  </item> 
  <item>
   <title>Query Optimization : Hi,I can&amp;#039;t provide a database...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14817#14817</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3708<br /><strong>Posted:</strong> 11-Oct-2012 at 3:42am<br /><br />Hi,<div><br></div><div>I can't provide a database but let's assume that my DB schema and indexes are all in good shape.</div><div><br></div><div>Then I have this kind of query (Disregard the logic here):</div><div>Another is there are no direct relationship between tables and models.</div><div><br></div><div><div>var customers = context.Customers.Join(context.Suppliers.Where(supplier =&gt; supplier.Active == true),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cus=&gt;&nbsp;cus.CustomerID,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sup=&gt;&nbsp;sup.SupplierID,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(cus,&nbsp;sup) =&gt;&nbsp;cus);</div></div><div><br></div><div><div>var stores = context.Store.Join(customers,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;store =&gt;&nbsp;store.StoreID,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cus=&gt;&nbsp;cus.CustomerID,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (store,&nbsp;cus) =&gt;&nbsp;store).Where(p=&gt; p.Active == true);</div></div><div><br></div><div>var remainder = 0;</div><div>var count = stores.Count();</div><div>var pageSize = 50;</div><div><div>var pageCount &nbsp;= Math.DivRem(count&nbsp;,&nbsp;pageSize&nbsp;, out&nbsp;remainder);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (remainder&nbsp;&gt; 0)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;pageCount &nbsp;=&nbsp;pageCount &nbsp;+ 1;</div></div><div><br></div><div>for (int x =0; x &lt;=&nbsp;pageCount ; x++)</div><div>{</div><div>&nbsp; &nbsp; <span ="Apple-tab-span" style="white-space:pre">	</span>var pagedStores = stores.OrderBy(o =&gt; p.StoreID).Skip(x * pageSize).Take(pageSize);</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>foreach(var store in pagedStores)</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>{</div><div><span ="Apple-tab-span" style="white-space:pre">		</span>Console.WriteLine("Store ID: {0}", store.StoreID);</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>}</div><div>}</div><div><br></div><div>Example my count is 50k records, so I will have 1k page..</div><div>What happen in this query, every page it adds approximately 1 second delay.</div><div>So meaning the first page is 1 second, second is 2 second delay and so on and it will come to a point that it will time out...</div><div><br></div><div>What do you think is the problem with this approach or do you have any &nbsp;solution that can improve our query?</div><div><br></div><div>Note: We already used the EntityQueryPager&lt;T&gt; but still no luck..</div><div>We also try juggling some of the QueryStrategy but also failed.</div><div><br></div><div>Thanks,</div><div>Von</div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Thu, 11 Oct 2012 03:42:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3708&amp;PID=14817#14817</guid>
  </item> 
 </channel>
</rss>