yuqi1129 opened a new issue, #13860:
URL: https://github.com/apache/gravitino/issues/13860

   ### Describe the subtask
   
   A cascading catalog or metalake drop soft-deletes all schemas (and, for a 
metalake, all catalogs) with one statement: `WHERE deleted_at = 0 AND 
((schema_id = ? AND current_version = ?) OR ...)`, one term per child.
   
   - MySQL plans the OR chain superlinearly: 17,000 schemas take 22.6 s and 
40,000 take 117 s, while the catalog and schema rows stay locked.
   - H2 scans the whole table for the chain, so the cost grows with the square 
of the child count (40,000 schemas: 21 s).
   - PostgreSQL rejects the statement once a catalog has more than 32,767 
schemas (65,535 bind parameters), so such a catalog cannot be dropped at all.
   
   Fix: split the versioned batch soft delete into chunks inside 
`OccWriteSupport#deleteChildrenWithVersions`, still in the caller's 
transaction, and add a leading primary-key `IN` list to the statement so each 
chunk finds its rows by index.
   
   ### Parent issue
   
   #13853
   


-- 
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]

Reply via email to