Boost logo

Boost :

Subject: Re: [boost] Help on 2 key search
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-18 01:54:18


Renee wrote:
>
> HiAll
> Being a newbie i request your help.
>
> I have a emp database. I store them based on emp id as well as ssn and
> need to store their extended details. What datatype is best used to store
> this info. I need to search through millions of emp recs that can be
> searched by either ssn or by emp id. do suggest.
> some fields are as below:
> emp id
> ssn
> emp first name
> emp last name
> emp sal
> emp age
> if we use map can have just one key value so it can be either ssn or emp
> id. using 2 maps one for ssn and emp record and another for emp id and emp
> record is not efficient as there are millions of records.
> ur help is appreciated. will multi index help in this case. do suggest.
>
> -Renee
>

Hi,

If you need to realize search based on these two fields MultiIndex seems the
appropriated structure.
If emp_id is an integer (unique) the use of a non-ordered index could give
you better performances. The major problem is how to ensure this id is
unique.

I guess that ssn stands for Social Security Number, which is too big to fall
on a builtin, so a string will be need. Again the use of a good hash could
improve the performances.

HTH,
Vicente

P.S. This kind of questions are better answered on the Boost User ML or even
on Stack Overflow.

--
View this message in context: http://boost.2283326.n4.nabble.com/Help-on-2-key-search-tp3530830p3531660.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk