Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 8th, 2012, 12:29 PM
immurk immurk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 2 immurk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old May 8th, 2012, 12:43 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,353 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 4 h 17 m 19 sec
Reputation Power: 4140
assume each word is associated with 5 others

then 20,000 words means 100,000 relationships

storing 200,000 relationships instead of 100,000 is ~not~ "insanely" large

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Reply With Quote
  #3  
Old May 8th, 2012, 12:52 PM
immurk immurk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 2 immurk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 59 sec
Reputation Power: 0
huh well if it scales like that, and im not sure it does, then you're absolutely right

thanks for your reply, i will try to do the math to see the difference in real numbers (didn't thought of it that way=

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Non-hierarchical Reflexive N to N relations

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap