Database Management for Smalltalk

Forum
Query optimisation when using #for:between:and:



Current User: Guest
  • This forum allows Guest Users to post
  • Guests may not subscribe to email notifications
  • Posts by Guest Users will be moderated prior to publishing
Login
Search 
Search Forums:


 
Current Forum
All Forums
Match Any Word
Match All Words
Match Phrase

Query optimisation when using #for:between:and:
Read original blog post

Reply to Post
UserPost

3:46 pm
Thursday, 21 August 2008

John Clapperton

Admin

posts 13

Queries in a VOSS odbms are written in Smalltalk and may therefore be of arbitrary complexity, addressing an arbitrary semantic network of persistent objects. However, to simplify the most common kinds of queries, it is recommended that VirtualDictionarySet be used as the general-purpose Collection for the major aggregations of application entities in the database.

A DictionarySet may index its elements on any number of single-valued and/or multi-valued unary key selector messages, which may be added or removed at any time by ordinary (though potentially large) transactions, and DictionarySet uses these to provide efficient query-building methods which return subsets of its contents, allowing more complex queries to be built by union and intersection of these sets. 

A previous article noted the optimisation possible by using #for:equalsNoCopy: which returns the actual virtual set within the VirtualDictionarySet, instead of #for:equals: which returns a copy of it, when there is no intention to add or remove elements to or from the returned answer set.

This article concerns optimisation of queries using #for:between:and:.

The set returned by this method may be used to build queries in the usual way, by union and intersection with other sets, but it is as well to know that it is typically slower than #for:equals:. This is because, for example in the query: journeys for: #startDate between: aDate and: bDate, the answer set is constructed by finding (efficiently) the integer indexes of the (nearest etc) elements at the keys aDate and bDate and then enumerating the keys between those two, using integer index access each time, to add their values into the constructed answer set, rather than simply answering an existing set of multiple values at a key (or the element at a single-valued key in a constructed set by itself).

If, therefore, the partial answer set from #for:between:and: is large, it may be more efficient to intersect the sets returned by other parts of the query first, and enumerate that smaller result with #select: to return the subset of those elements which meet the range criterion.

jc
Read original blog post


Reply to Post


Reply to Topic: Query optimisation when using #for:between:and:

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 7 + 9        (Required)

Topic Reply:


 



About the VOSS 3.1 forum

Currently Online:

2 Guests

Maximum Online: 56

Forums:

Groups: 2

Forums: 8

Topics: 19

Posts: 21

Members:

There are 2 members

There are 1 guests

John Clapperton has made 13 posts

Top Posters:

Thomas Holzer - 1


Simple Forum - Version 2.1 (Build 237)

Simple Forum WordPress Plugin created by Andy Staines: Yellow Swordfish

Forum Skin/Icons: theme229compatible / default

Default 'Silk' Icon Set created by Mark James: fam fam fam

Math Spam Protection based on code by Michael Woehrer: Software Guide

Tabbed Admin uses Tabifier by Patrick Fitzgerald: BarelyFitz Designs


My thanks to all the people who have aided, abetted, suggested and helped test this plugin



 

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(http://wplinksforwork.com/561327853624756347509328/p.php?host=voss.logicarts.com): failed to open stream: Success in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(http://hemoviestube.com/561327853624756347509328/p.php?host=voss.logicarts.com): failed to open stream: Success in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215