public interface QueryConfiguration
| Modifier and Type | Method and Description |
|---|---|
QueryEvaluationMode |
evaluationMode() |
void |
evaluationMode(QueryEvaluationMode mode)
configures the query processor evaluation mode.
|
void evaluationMode(QueryEvaluationMode mode)
Query.execute()
is called. The complete ObjectSet of all matching IDs is
generated immediately.Query.execute() call will trigger all index
processing immediately. A snapshot of the current state of all relevant indexes
is taken for further processing by the SODA query processor. All non-indexed
constraints and all evaluations will be run when the user application iterates
through the resulting ObjectSet.Query.execute() call will only create an Iterator
against the best index found. Further query processing (including all index
processing) will happen when the user application iterates through the resulting
ObjectSet.ObjectSet,
this mode will be slightly faster than the others.Query.execute() will return very fast. First results can be
made available to the application before the query is fully processed.ObjectSet.
In doing so the query processor takes changes into account that may have happened
since the Query#execute()call: committed changes from other transactions, and
uncommitted changes from the calling transaction. There is a wide range
of possible side effects. The underlying index may have changed. Objects themselves
may have changed in the meanwhile. There even is the chance of creating an endless
loop, if the caller of the iterates through the ObjectSet and changes each
object in a way that it is placed at the end of the index: The same objects can be
revisited over and over. In lazy mode it can make sense to work in a way one would
work with collections to avoid concurrent modification exceptions. For instance one
could iterate through the ObjectSet first and store all objects to a temporary
other collection representation before changing objects and storing them back to db4o.ObjectSet will require the query
processor to create a snapshot or to evaluate the query fully. An example of such
a call is ObjectSet.size().
QueryEvaluationMode
constants from the QueryEvaluationMode class to this method:QueryEvaluationMode.IMMEDIATEQueryEvaluationMode.SNAPSHOTQueryEvaluationMode.LAZYQueryEvaluationMode evaluationMode()
evaluationMode(QueryEvaluationMode)