I've created two simple Django Models. One model simply holds the bill details. The other one holds the list of items purchased in that Bill, linked through a foreign key relation. I'm stuck at a problem of creating a very large database with this implementation. Model Classes :
class Bill(models.Model):
seller_id = models.ForeignKey(User , related_name = 'bill')
amount = models.DecimalField(max_digits = 7 , decimal_places = 2)
customer_id = models.ForeignKey(User , related_name = 'bill')
and
class BillItems(models.Model):
bill = models.ForeignKey(Bill , related_name = 'items')
product = models.ForeignKey(Product , related_name = 'items')
quantity = models.DecimalField(max_digits = 6 , decimal_places = 3)
Now as I see it , after some time my database(MySql) would have a very large number of Bill Items' instances. Is there a better way to implement such a structure? OR Is there a way to optimize this structure?
Thanks and Regards.