|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, February 21, 2013 5:45 AM
Points: 19,
Visits: 8
|
|
hello, I have aprox 70,000 words and want to store this data in DB, for this there are two ways as below:
1. add a single row that will have comma separated list of that 70,000 words. So the total records in the table will be 1
2. add all the 70,000 words as single single rows in table so total 70,000 rows in the table
what will be the best way to do this and why the solution is best. :)
Please explain... Thanks, VinC
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 9:10 AM
Points: 2,367,
Visits: 4,409
|
|
It depends on your business requirement( What are you going to do with this 70,000 words? )
If you intend to handle each word differently by joining them individually to some other table, then its better to store them as 70,000 rows But as I said, we can't decide without knowing the business requirement.
Kingston Dhasian
How to post data/code on a forum to get the best help - Jeff Moden http://www.sqlservercentral.com/articles/Best+Practices/61537/
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:11 AM
Points: 1,130,
Visits: 1,278
|
|
Hi,
It depends on your requirement. If you to perform any operation on those words later like update etc. then its better you store those 70K words in 70K rows else you can store in a single rows of table with comma separated values.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, February 21, 2013 5:45 AM
Points: 19,
Visits: 8
|
|
My requirement is like i have to search the word from this 70,000 words. so 1st i have to store that in the table then execute select statement with like operator. Also there will not be only 70,000 records it will be increased to may be 70,00,000 + too
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 9:37 AM
Points: 512,
Visits: 2,244
|
|
You may want to consider Full-Text Search if your list is going to grow to 70 million+ words.
From MSDN:
A LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.
----------------------------------- http://www.SQL4n00bs.com
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 9:10 AM
Points: 2,367,
Visits: 4,409
|
|
vchauhan_me (2/21/2013)
My requirement is like i have to search the word from this 70,000 words. so 1st i have to store that in the table then execute select statement with like operator. Also there will not be only 70,000 records it will be increased to may be 70,00,000 + too 
In that case its better if you store these rows in 70,000 different rows so that you can do a JOIN You cannot do a JOIN with the word if you store all the words in a single comma separated row.
Kingston Dhasian
How to post data/code on a forum to get the best help - Jeff Moden http://www.sqlservercentral.com/articles/Best+Practices/61537/
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:11 AM
Points: 1,130,
Visits: 1,278
|
|
Ok then my suggestion is to store words in separate rows so that you can perform operation LIKE as you mentioned.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, February 21, 2013 5:45 AM
Points: 19,
Visits: 8
|
|
Thanks for the reply from all of you, but i need the specific reason why separate rows (70,000 rows) are more preferable to store in DB in place of comma separated list, its like i need to search the keyword from the list but that is also done quite easily with comma separated record.
Is there any documentation for such thing then it will be good for me to clear this view.
but thanks for the reply
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 9:10 AM
Points: 2,367,
Visits: 4,409
|
|
vchauhan_me (2/21/2013)
Thanks for the reply from all of you, but i need the specific reason why separate rows (70,000 rows) are more preferable to store in DB in place of comma separated list, its like i need to search the keyword from the list but that is also done quite easily with comma separated record. Is there any documentation for such thing then it will be good for me to clear this view. but thanks for the reply 
Can you replicate your problem with the help of a CREATE TABLE statement, some sample data( say 5 rows ) and the query you will be running on the table? It will then be easier for us to give you better suggestions.
Kingston Dhasian
How to post data/code on a forum to get the best help - Jeff Moden http://www.sqlservercentral.com/articles/Best+Practices/61537/
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 8:18 AM
Points: 386,
Visits: 1,424
|
|
INSERT INTO PseudoTable VALUES ('Tear,Bike,Monkey')
SELECT * FROM PseudoTable WHERE Item LIKE '%tea%'
1 row returned.
INSERT INTO PseudoTable VALUES ('Tear') INSERT INTO PseudoTable VALUES ('Bike') INSERT INTO PseudoTable VALUES ('Monkey')
SELECT * FROM PseudoTable WHERE Item = 'tea'
0 row returned.
The SQL Guy @ blogspot
About Me
|
|
|
|