Hi all, I was wondering about the technical reasons why deleting sliced querysets is prohibited (the error thrown is Cannot use 'limit' or 'offset' with delete()).
This makes it really complex when one wants to delete huge amounts of data (think millions of rows): The only supported options are to delete everything at once (really slow + locks the table due to having to rewrite indices), or to issue a delete statement for every single row (creates millions of statements). It would be really nice to have some form of batched deletion, e.g. 1k rows at a time, and use that to iterate through the entire dataset that needs to be deleted. This means that each query will be fast, the locks will be released regularly so that other threads can get their work done in between batches without too much waiting, and at the same time limit the number of queries that get sent. I assume that there must be some technical reasons for this limitations, and would like to understand them. And if the technical reasons turn out to be outdated, I would love to see this limitation be solved! Alternatively, does anyone have a good recommendation on how to work around this? I can't be the first person with this problem! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b794b4e9-35e6-4a9d-bebb-817f79f79bden%40googlegroups.com.