-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DB: do not fetch
data
and others when deleting rows (#10446)
* DB: do not fetch `data` and others when deleting rows This task was cancelled again. The query shows a SELECT first that fetchs the whole rows. I think we can reduce this time/memory by only fetching the ids. * DB: only fetch "id" when deleting rows * DB: clean up old data using raw SQL from Django We are facing an issue with this query because it takes too long to execute (more than 30s) making our DB to kill the query. This is because Django performs a `SELECT` first to be able to trigger pre_ and post_ delete signals on each object delete. We don't really need this here, so we are using raw SQL to bypass this and make the query to execute faster. This is not ideal, but we didn't find a better approach. * DB: there is no results to fetch The query is executed without requiring `.fetchall()`
- Loading branch information
Showing
2 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters