[Glass] Query results as Streams and indexes question
BrunoBB via Glass
glass at lists.gemtalksystems.com
Fri Jan 6 07:21:54 PST 2017
Dale,
My mail was a little confusing i think...
Yes readStream is sent to aGsQuery (using GS 3.3.0):
('each.username = ''admin''' asQueryOn: instancesSet) readStream.
"where <instancesSet> is an RcIdentityBag"
There error arise when there is NO index on this collection <instancesSet>.
After executing the following then i get <aRangeIndexReadStream> from the
previous sentence (no error):
GsIndexSpec new
equalityIndex: 'each.username' lastElementClass: String;
equalityIndex: 'each.groupname' lastElementClass: String;
createIndexesOn: instancesSet.
I was trying to figure out how to deal with indexes at code level in a very
specific situation.
But i think is solved when you said:
"#do: and #readStream both attempt to avoid scanning the entire result
set and can both be used if you don't intend to to scan the entire
result set"
I thought (i do not why) that #do: will load all objects to memory :(
If that NOT case then #do: over aGsQuery will do the job for me :)
Also from that large result i need to copy a small segment of objects (for
paging purpose on a web page).
The result maybe has 100.000 objects and i want to get objects from position
20 to 30.
There is no #copyFrom:to: in GsQuery. What is the best to do ?
aGsQuery queryResult copyFrom: 20 to: 30.
"this will load all result to memory ?, size use #queryResult so it should
not load all objects to memory"
Or use: aGsQuery readStream position: 20.
Sorry for my previous confusing mail ...
regards,
bruno
--
View this message in context: http://forum.world.st/Query-results-as-Streams-and-indexes-question-tp4928858p4928948.html
Sent from the GLASS mailing list archive at Nabble.com.
More information about the Glass
mailing list