I have two tables:
Table 1: Date (String: 'YYYYMMDD'),
Path (String: '/user/tom/', a directory path),
Size (Bigint: 1293232943, size of directory)
Table 2: Date (String: 'YYYYMMDD'),
Path (String: '/user/tom/logs/file.txt', a file path),
Count (Bigint: 282, number of times file has been opened)
I would need to make several various queries that take collect the total access count under a directory which would be found by querying table 2 and looking for all paths that are like concat(t1.Path, '%'). Is there a better way to structure this table so that queries like this are efficient and most importantly, the database does not take too much space.
So I tried creating a third table for storing an id for each path, and while the query is more complex, it stores less data but it's still somewhat meaning less since there is no structure to the id. It assigns a number to each path as long as its not in it already.
I'm trying to find the most efficient way and that saves space to store this data. Any help would be appreciated.
date