spectraphilic / wsn_server

Software and django applications for wsn and iot setup
GNU General Public License v3.0
1 stars 0 forks source link

Merge metadatas #7

Closed jdavid closed 5 years ago

jdavid commented 5 years ago

Looking at the queries, it turns out that having less metadata objects improves query performance sometimes, specially as it makes the planner to plan a bit differently.

Look to merge metadata objects, so there's only one metadata per name, ideally. This would be done dropping some info from the metadata, for instance we can drop the IP address from frames uploaded through 4G.

If we still want to keep that info we may add another table, with the list of IP addresses associated to a metadata (following the example). Here we will loss the relation between frames and IP address. We may add a counter to know how many frames have been uploaded with some IP address.

Write a Django command to merge metadata objects.

jdavid commented 5 years ago

TODO:

jdavid commented 5 years ago

Reduced the number of metadata rows from 4688 to 156, moving the remote_addr field from the metadata to the data, because it changes often.

Found that sometimes the frame was saved but the response didn't reach the mote. This made the mote to send again the frame producing duplicates in the database, where the only difference was the remote_addr. Now the "new" frame will be skipped, avoiding duplicates, since the metadata object will be the same.