bito-code-review[bot] commented on PR #44349: URL: https://github.com/apache/superset/pull/44349#issuecomment-5706427862
<!-- Bito Reply --> The performance concern raised in the review is valid. The current implementation uses separate lists for entity types and UUIDs to scope the re-check, which can lead to a Cartesian product (cross-product) if not handled carefully, potentially causing the database to scan a large number of unrelated entity histories while holding the coordination lock. To resolve this, you should ensure that the entity scoping uses paired tuples (e.g., `(entity_type, entity_uuid)`) rather than separate lists. This forces the database to filter by the specific entity pairs identified during the discovery phase, preventing the cross-product and keeping the scan bounded by the batch size. ### Proposed Fix In `superset/commands/deletion_retention/prune_audit.py`, update the scoping logic to use paired tuples: ```python # Instead of separate lists, use a list of tuples for the scope: scope_entities = list(set(zip(entity_types, entity_uuids))) # Then, in the SQL query, use a tuple comparison: # WHERE (entity_type, entity_uuid) IN :scope_entities ``` Would you like me to check the other comments on this PR and implement fixes for them as well? **superset/commands/deletion_retention/prune_audit.py** ``` # Instead of separate lists, use a list of tuples for the scope: scope_entities = list(set(zip(entity_types, entity_uuids))) # Then, in the SQL query, use a tuple comparison: # WHERE (entity_type, entity_uuid) IN :scope_entities ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
