I am trying to build a local database for android. I am a little lost.
The app is a document management app.. I need to save the following…
Document
--------
Id
import date
List<DocTags>
extension
etc
then I have a number of docTags that have different information
Location
-------
id
name
lat
long
Company
------
Id
name
Street
town
around 10 other doc types.
I realise I need a table to store all the docTag ids that are assigned to a document but these relate to lots of different tables. My problem is that I need to retrieve a list of documents by searching for the doctag Id or multiple doctag ids. We need to assume we have 10,000 documents of more which could equate to 40,000 doc tags. So performance is a major issue. What is the best way to structure the database?
I will also need to search the doctag names.
Thanks
I’d have a many to many JOIN table relating Document to Tag.
I would not have those tags in multiple tables. That breaks first normal form. If other tables need to refer to Tag rows, give them JOIN tables as well.
Your comments below suggest that either a normalization refresher is necessary or that a relational model might not be the best choice for your problem. Perhaps a NoSQL, document based solution would fit better.