I have a query with several million records. I need to update a boolean, toggle it at the root, so that the values in the database table are reset. What is the fastest way to do this?
I tried navigating through a set of queries and updating and saving each record, which obviously takes a lot of time? We need to do this very quickly, any suggestions?
See the documentation :
Entry.objects.all().update(value= not F('value'))
Actually, this did not work for me.
Following:
Entry.objects.all().update(value=(F('value')==False))