-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: slow records deletion query (#2737)
Deleting records by syncId is unnecessarily slow because the sql query doesn't use the partition key (connectionId/model). It becomes very visible when deleting 100_000s records. This commit add connection and model parameter to the `records.deleteRecordsBySyncId` function. Note: all functions in `records` should take `connectionId/model` as parameter so query can be efficient. Not sure how we could enforce this other than via PR reviews but it is something to keep in mind Note2: fix for sync_config_id must be merged first: #2736 https://linear.app/nango/issue/NAN-1730/delete-records-is-slow EXPLAIN before: ``` Delete on records (cost=2026.15..4725.10 rows=0 width=0) ... ``` EXPLAIN after ``` Delete on records (cost=0.28..16.34 rows=0 width=0) ... ```
- Loading branch information
Showing
8 changed files
with
56 additions
and
10 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
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
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
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