db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

Caching (reusable) S.O.D.A queries

Last post 07-14-2008, 08:58 PM by ErikNRC. 3 replies.
Sort Posts: Previous Next
  •  07-10-2008, 02:15 PM 50083

    Caching (reusable) S.O.D.A queries

    I have been working on extending the query API to enable reusing them  and cache results for a set of constraints. I already have about 10% improvement simply by reusing the queries. On any query that is ran multiple times the improvements can be massive however, these results won't be visible with the existing benchmarks. Could this still qualify for the contest?

     

  •  07-10-2008, 02:50 PM 50084 in reply to 50083

    Re: Caching (reusable) S.O.D.A queries

    An example of what I am trying to achieve is

    String randVal = "child-" + randomPosition();
    if (_randomValueQuery == null) {
    	_randomValueQuery = newQuery().cached();
    	_randomValueQuery.onCache().constrain(DBTree.class);
    	_randomValueQuery.onCache().descend("_root").constrain(root1);
    } else {
    	_randomValueQuery.init();
    }
    _randomValueQuery.descend("_node").constrain(randVal);
    Iterator it = _randomValueQuery.execute().iterator();
  •  07-14-2008, 04:37 PM 50124 in reply to 50083

    Re: Caching (reusable) S.O.D.A queries

    ErikNRC:

    I have been working on extending the query API to enable reusing them  and cache results for a set of constraints. I already have about 10% improvement simply by reusing the queries. On any query that is ran multiple times the improvements can be massive however, these results won't be visible with the existing benchmarks. Could this still qualify for the contest?

     

    Of course this would qualify!

    Feel free to write a dedicated Poleposition circuit that measures rerunning the same query multiple times.

  •  07-14-2008, 08:58 PM 50129 in reply to 50124

    Re: Caching (reusable) S.O.D.A queries

    Carl Rosenberger:

    Of course this would qualify!

    Feel free to write a dedicated Poleposition circuit that measures rerunning the same query multiple times.

    Ok will do! I finally got something working and with 10000 objects I have 45% improvement with the example above. Unfortunately, this won't be a pretty patch, I had to modify most of the Query classes and the cache itself is an object in the transaction; although I haven't changed the execution path without cache.

    Erik.

View as RSS news feed in XML