
May 8th, 2012, 12:29 PM
|
|
Registered User
|
|
Join Date: May 2012
Posts: 2
Time spent in forums: 31 m 59 sec
Reputation Power: 0
|
|
|
Non-hierarchical Reflexive N to N relations
Hi
I have a question on modelling a specific kind of database
To better explain - I want to make a relation consisting of words which are connected to each other by meaning (like a thesaurus)..for this, I need to build such a model where in one relation i will have all the words with their ids, and in the other i will have which word is connected to which..
now..what I want to know is which model for the second relation is better:
a) duplicate connections so I only search from one index, like this:
word1 - word2
word1 - word3
word2 - word1
word2 - word4
word2 - word5
word3 - word4
word3 - word1
word4 - word2
word4 - word3
..
or
b) dont add connection if it already exists in the opposite direction, search by both indexes, like this:
word1 - word2
word1 - word3
word2 - word5
word4 - word2
word4 - word3
word5 - word6
Obviously the a) will make my search shorter but the database will get insanely big, while b) will make the database shorter but will prolong the search process..so which one of these is more efficient in a scaled version of the database where there's like 20,000 words or sth, in your opinions? I'm really in a quarell with myself on this one 
|