Postgres batch enqueuing in ten lines of Django

from blog Applied Cartography, | ↗ original
It hasn't failed me yet: BATCH_SIZE = 100 def batch_proess(queryset) -> None: count = queryset.count() if count == 0: time.sleep(10) return with transaction.atomic(): batch = list( queryset.select_for_update(of=("self",), skip_locked=True).values_list( "id", flat=True ...