Filtering array vs plain list
Shari
shari at gypsyware.com
Fri Feb 1 17:36:40 EST 2008
I'm trying to determine the best way to store a humungous block of
data for both speed and accessibility.
My original plan was to do an array something like this:
Item #2 is an identifier unique to each individual. It will not be a
number, but text + a number.
census[Atlanta,5489,name] = John
census[Atlanta,5489,religion] = Baptist
census[Atlanta,5489,birthYear] = 1976
census[Atlanta,5489,baseballTeam] = Braves
census[Atlanta,5489,eyeColor] = blue
census[Atlanta,9988,name] = Judy
census[Atlanta,9988,religion] = Mormon
census[Atlanta,9988,birthYear] = 1926
census[Atlanta,9988,baseballTeam] = Yankees
census[Atlanta,9988,eyeColor] = green
census[Chicago,3258,name] = Billy
census[Chicago,3258,religion] = Atheist
census[Chicago,3258,birthYear] = 1982
census[Chicago,3258,eyeColor] = blue
census[Chicago,3258,baseballTeam] = Red Sox
Alternately of course this could be a list with each line dedicated
to the individual.
Each individual would have 300-400 different items and there will be
thousands of individuals.
The data needs to be accessed very very quickly, which points to an
array as above. And most of the time very specific pieces of data
will be accessed and updated. And changes will be made constantly.
So far, so good.
But here's the glitch.
I need to also be able to make global changes to the list, for
example, update everybody whose baseball team is "Red Sox" and
birthYear is 1950. For example, change all instances of Red Sox to
White Sox if the birthYear is 1950.
Is there any way short of looking inside each element of thousands of
keys for the matching birthYear/baseballTeam?
This would presumably be very slow. But if the array were a list
with thousands and thousands of lines, each line having 300-400
items, wouldn't that be slow to access as well?
What am I missing?
Shari
--
WlND0WS and MAClNT0SH shareware games
BIackjack GoId
http://www.gypsyware.com
More information about the use-livecode
mailing list