Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

How would you store text information - in a relational database or maybe using NoSQL? The problem is that the text should be divided into various parts, each of which satisfies to some requirement, e.g. the same text should be contained in several "places". Is there another way to organize this?

I have several books (each of them about 600 pages), which should be stored in a database, but there will be a mechanism which should sort the content of the books by some criteria. The criteria are complex, so I wonder if it is becoming a big problem. Would it help to store the same text in various "tables", each of which would satisfy a concrete "condition"

Do I need to save the same text in various "tables", each of which satisfies a specific set of criteria?

share|improve this question
7  
I think we'll need a little more detail, or some simple examples, before any of us here can give you good advice. –  wolfgangsz Jul 7 '11 at 9:36
    
more information required in particular are you A:trying to store text data that may be used for printing/display purposes or B: trying to store data inputed by users? –  armitage Jul 7 '11 at 12:06
1  
Did you consider using solr ? Hard to tell what you need from what you say, but my intuition is that it' what you need. –  deadalnix Jul 7 '11 at 13:01
    
An example of the type of content and some conditions would make it easier to answer. –  glenatron Jul 7 '11 at 13:53
    
Several books of 600 pages sounds like a job for grep not a database –  Lothar May 2 at 2:55

2 Answers 2

It is not good RDBMS practice to duplicate data in multiple tables, generally speaking. There are ways, using keys (primary keys and foreign keys), to link data so that this very disaster is averted.

RDBMS is a science within itself. I recommend picking up some reading material on the subject before even attempting to design a database structure. And 9 times out of 10, NoSQL is not the answer.

share|improve this answer

I think much better approach would be to store the whole, single text - possibly even outside the database, and in the actual work table store pointers, criteria, offsets and ranges to it, keyword indices and so on. Simply, separate data from metadata, the book contents from contextual search data.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.