[erlang-questions] Mnesia: select random record

Christian S chsu79@REDACTED
Sat Sep 30 15:15:38 CEST 2006


On 9/30/06, datacompboy <datacompboy@REDACTED> wrote:
> [quote="noss"]Can you revise this idea to try something different that will accomplish the same?
> (end of quote)
>
> Sorry, what do you mean?

I mean that perhaps you should consider other designs than scanning a
table until you find the Nth record, where N is chosen at random.

The problem you have has way more than one way to solve it, and it is
difficult to sift through them to find optimal solutions without
knowing estimates on various sizes (advisors in pools, number of
pools, osv) and knowing what will have to scale.

Storing {PoolId, [AdvisorId]} in one table, and having advisor data in
another {AdvisorID, Data...} would allow you after only one query find
all Advisors in a pool and pick one at random. Then one more query if
you needed associated advisor data.

Just take the advisor out of the pool the duration you're using it.



More information about the erlang-questions mailing list