Thread is closed for posting
3 posts, 0 answers
  1. Sven
    Sven avatar
    6 posts
    Member since:
    Jun 2009

    Posted 15 Jul 2009 Link to this post

    We have two tables A and B with a many-to-many relationship. This is realized via a simple link table containing the IDs of each table.
    Only table A contains some 500 rows - the link table and table B are completely empty. If we now try to access the data with
    var result = from x in scope.Extent<A>() select x;
    List<A> resultlist = result.ToList();

    everything works fine. But trying to fill an ObjectContainer afterwards by
    ObjectContainer oc = new ObjectContainer();
    oc.CopyFrom(scope, "MyNamedList", result, null);

    the CopyFrom takes an extremely long time to complete (approx. 3 minutes for 500-1000 rows in A).
    Looking at the log output it shows that for each row in A a JOINed query is performed on B.
    In our case the DB is accessed by an internet connection - running against a local SQLExpress DB the effect might not be that noticeable.

  2. Thomas
    Thomas avatar
    590 posts

    Posted 17 Jul 2009 Link to this post

    Hello Sven,

    I think there are two issues here:
    (a) The original query should fetch everything that is needed later in the CopyFrom in an efficient manner.
          In your case you should have a FetchField attribute set on A's B collection field, and add the fetch  
          group to the FetchPlan of the scope before doing the query.
          In addition to that please set the ParallelFetch property of the result to true. This allows us to just issue
          two queries; Optimal!
    (b) The fetched data can be GC'ed. In order to avoid that you need to specify
          in the backend configuration section of your app.config file manually. This changes the way OpenAccess references data that was read from the server but is not referenced from the user app - like the query result content.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Sven
    Sven avatar
    6 posts
    Member since:
    Jun 2009

    Posted 17 Jul 2009 Link to this post

    Thanks for supporting our evaluation. Actually this did the trick.
Back to Top