I'm creating a web app with Django 3.1
and there's lots of DB interaction
s mostly between three tables. The queries mostly use results that are recent inputs. So query1
will run and update table1
, query2
will use table1
to update2 table2
and query3
will use the column
updated by query2
to update other columns
of table2
. All these run every time users input or update info.
Perhaps a visual will be clearer.
query1 = Model1.objects.filter(...).annotate(...)
query2 = Model2.objects.filter(...).update(A=query1)
query3 = Model2.objects.filter(...).update(B=A*C)
I'm beginning to worry about speed between python
and PostgreSQL
and can lose data when multiple users start using it same time. I read about celery
and Django Asynchronous support
, but it's not clear if I need celery or not.
This is a very simplified version but you get the gist. Can someone help me out here please.