[erlang-questions] Getting attributes

Jim jrosenblum@REDACTED
Sun Oct 14 04:09:16 CEST 2012


How about use two index columns consisting if the bit representation of the x and y coordinates as in {key, attribute, 000000000001, 000000000010}. Use mnesia and just do the math on the bits to calculate the next select   

Depending on your problem, It's possible for the key to be {bitstring1,bitstring2}

Sent from my iPhone

On Oct 13, 2012, at 9:52 PM, Mike Oxford <moxford@REDACTED> wrote:

> Sure; you have two ways of doing this.
> 1)  Key = {x,y} and just make queries for each surrounding node to get the attributes.  This requires more read calls.
> 2)  Key = {x,y} and you COPY all of the data from the surrounding nodes into it.  This requires only 1 read call, but much more work on the write-side as things move around.
> 
> On a heavy-write system, #2 will spend a lot of time blocked as everything is updating everything around it when it moves (from cluster + to cluster.)
> #1 takes more reads which are relatively cheap.
> 
> It depends on your read/write profile balance.  On a very heavy "read" system where thing do not move often, #2 will be best.  On a system with lots of moving around, #1 is better.  Where that boundary line lies is specific to your own application's patterns and this figuring out this pattern will dictate which method is best (or even if you really want to go KV for this.)  Profile it, even if your first-pass profile is just on paper/pencil.
> 
> -mox
> 
> On Sat, Oct 13, 2012 at 4:38 PM, Steve Davis <steven.charles.davis@REDACTED> wrote:
>> I understated the issue:
>> 
>> The position of the entity can also change:
>> {id, {x,y}, attribute}
>> 
>> So, in fact, the id is the only constant and the pos and attribute are independently mutable.
>> 
>> 
>> 
>> On Oct 13, 2012, at 6:23 PM, Steve Davis <steven.charles.davis@REDACTED> wrote:
>> 
>> > Hi all,
>> >
>> > Suppose I have a 2 dimensional plane {x, y} of 64k by 64k coordinates.
>> >
>> > Each coordinate has a mutable attribute {{x, y}, attribute}
>> >
>> > If I need to query: What are the attributes of positions "next to" my position, i.e: x +- 1, y +- 1?
>> >
>> > What is the correct solution to this without storing everything in "Oracle" and using relational queries?
>> >
>> > Can this be sensibly maintained in a KV store?
>> >
>> > /s
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121013/1523e6a1/attachment.htm>


More information about the erlang-questions mailing list