30 minutes seems like a weirdly long time to delete 54,000 rows; doing something in SQLite like
CREATE TABLE stars (id INTEGER PRIMARY KEY, user TEXT, repo TEXT);
INSERT INTO stars SELECT
value AS id,
'User ' || value AS user,
'foo' AS repo
FROM generate_series(0,53999);
SELECT * FROM stars;
DELETE FROM stars WHERE repo = 'foo';
is just about instantaneous. I'm sure GitHub's schema is more complicated than that, but it can't be that much more complicated, right? Are there a bunch of tables referencing the actual GitHub stars themselves as foreign key constraints or something? Or a bunch of triggers on update/delete?It also seems weird that it would be necessary to delete those rows at all; yeah, having stars for private repos is kinda pointless, but other than taking up space it doesn't seem like it'd do much harm, either. If the space taken up is really that much of a concern, then a periodic cleanup job along the lines of
DELETE stars FROM stars JOIN repos ON
stars.repo_id = repos.id
WHERE
repos.visibility = 'private';
seems more sensible than just immediately deleting everything (and insisting on that deletion having finished before allowing another visibility change).