python - Cloning Django models or add a differentiating field in the second model? -
I have to store live streaming 'test' data and training data in a MySQL database. I need to create a Django model for this. Now the structure of the data is exactly like i.e. time, value, label
. The only difference between the two models will be used for training data and the other will keep alive test data (production data).
Which way would be a better way to create models in terms of performance:
- Create two models, TrenadiaDial and TestData models.
- Create a single model 'data' and 'training' by adding a boolean field to say whether data is part of a test / train dataset.
Now, training will be done in the initial steps and will be much smaller in size than test data; Additionally, the amount of test data will be very high (~ 20-30 GB)
Processing data involves running classification algorithm based on data collected. In my special case, training data must be accessed repeatedly for each classification work.
- For the first case, I have to ask two tables. It will be quick to check training data because the size of the data will actually be small.
- For the second case, the DB will be huge which will affect the query response time, but only one table will be reached. / Li>
Which will be faster in my use?
I am a newbie on database query optimization Therefore, suggestions / indicators will be appreciated. If there is any alternative way to do this (above two above), then those suggestions are also welcome.
Use class data modell (model): Time = ... value = ... label = ... class train data modell: pass class test data model (data modell): pass
and use indexes for optimization , And as Lara says the Django document sees
Comments
Post a Comment