나는 사전을위한 복잡한 데이터베이스 스키마를 가지고있다. 키워드 중 하나에 자신을 속할 수관계형 데이터베이스에서 개체를 모델링하고 쿼리하는 방법은 무엇입니까?
Entry {
keyword;
examples;
tags;
Translations;
}
Translation {
text;
tags;
examples;
}
및
Example {
text;
translation;
phonetic_script;
}
즉, 태그 (즉, 문법)
로, 또는 각 객체 (본질적으로 번역)이 유사하다 번역 (외국어의 문법) 및 유사한 예는 번역 자체 (외국어 설명) 또는 항목의 텍스트에 속할 수 있습니다. 그런 종류의 관계형 디자인으로 끝났습니다.entries(id,keyword,)
tags(tag)
examples(id,text,...)
entrytags(entry_id,tag)
entryexamples(entry_id,example_id)
translations(id,belongs_to_entry,...)
translationtags(transl_id, tag)
translationexamples(transl_id,example_id)
내 주요 작업은이 데이터베이스를 쿼리합니다. "foo"를 검색한다고 가정 할 때 현재 처리 방법은 다음과 같습니다.
query all entries with foo, get ids A
foreach id in A
query all examples belonging to id
query all tags belonging to id
query all translations belonging to A, store their ids in B
foreach tr_id in B
query all tags belonging to tr_id
query all examples belonging to tr_id
내 개체를 다시 작성하십시오. 이것은 나에게 성 가시고, 느립니다. 조인이나 다른 방법을 사용하여이 문제를 크게 개선 할 수있는 방법이 없습니다. 데이터베이스의 관계에 이러한 개체를 모델링하는 데 어려움이 있습니다. 이것은 적절한 설계입니까?
어떻게하면 쿼리 시간을 개선하는 데 더 효율적이 될 수 있습니까?
NoSQL과 같은 다른 데이터베이스 솔루션을 고려해보십시오. RDBMS는 모든 솔루션입니다. – Amirshk