I have currently two tables: TableA and TableB. Both tables are having about ~10-15 columns, and TableB got a foreign key on TableA's primary key. In TableB I am storing if one row is marked/checked. TableA is usually in relation with about 100-500 rows of TableB(foreign key). It looks like that:
In my android application I frequently have to retrieve all data of TableA and additionally get this values (all limited to the specific row id of TableA):
- count of rows of TableB which were marked(set to 1)
- count of all rows of TableB
- the row of TableB with the highest Id, which is not marked(set to 0)
The standard solution and my first idea was that I query to get the marked rows and query to get the row with the highest Id for every row of TableA. But would that be with good performance? It should be getting retrieved as fast as possible, since all rows of TableA will get frequently retrieved.
So my other solution was to store the appropriate data in the columns of TableA, so I don't have to query the rows of TableB. That would look like that.:
But my question is: Would the second solution make that much of a difference performance-wise? Do we notice, that it would get faster retrieved? Does SQLite can query that much data that fast? Or would the extra effort not be worth to manage additional fields of TableA?
Maybe that kind of a question is already answered, but I didn't know what to look for.
Aucun commentaire:
Enregistrer un commentaire