Re: Search algorithm
- From: user923005 <dcorbit@xxxxxxxxx>
- Date: Tue, 12 Feb 2008 13:14:58 -0800 (PST)
On Feb 12, 1:33 pm, gg <gi3...@xxxxxxxxx> wrote:
Hello,
I have to find algorithm which
give me contractors whos the best matching to some conditions.
Contractors are stored in DB and number of conditions is up to 20.
Some conditions are importants then another.
At this moment I have two algorithm:
1.
Get all contractors from DB, iterate over set
and give score for matching to conditions.
At the end sort set (scores) and cut result to 100 contractors.
2.Make shot to DB for all conditions apart, get
set contractor idenifiers, give scores for identifiers,
maintain in memory HashMap<Identifier, Scores>
after DB shot update table in memory.
What do You thing about this solution. Have you any another idea ?
Now I'm convinced do 2 solution because first seems to be slow.
I will implement this in 3 layer aplication in Java language.
If you can modify the schema, then add the appropriate indexes to
speed up your queries.
If you show the schema to the database and the exact conditions you
need for your queries, then I guess that better suggestions can be
made.
Depending on the database, a unique, clustered index is often the
golden key to speed.
.
- References:
- Search algorithm
- From: gg
- Search algorithm
- Prev by Date: Re: sorting 1 million integers with 2MB RAM
- Next by Date: Re: Results of the memswap() smackdown from the thread "Sorting" assignment
- Previous by thread: Search algorithm
- Index(es):
Relevant Pages
|