Closed dhoko closed 1 year ago
Since the CLI is faster this most likely comes from a different configuration. E.g. the CLI does not have foreign keys enabled. Try disabling foreign key checks and see what happens.
I didn't think the config could be different 🙈
Yep I tried foreign_keys=0
but while it did improve the speed to be as fast as the cli today, it came with a 🔴 flag, database corrupted :/
Hello 👋
I have an issue with
exec
taking hours to execute.Here is my table:
It joins 2 tables with 100 rows for locales, and 24 for projects.
I'm running a test sql file with 1000s of delete, it's something taking 3s via the CLI but taking hours via
db.exec
https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#execstring---this cf:table-metrics.sql.zip
Before using this flow, I was doing a db.prepare + run via a transaction or without and it was taking 800ms by id 🤯 with 109 382 ids to remove 🔥 Turns out, exec is just as slow 😢
But as doing it via the CLI shows us it's a bug as it's possible to be done <3s.
What's weird is inside my process, I clean another table with 274 610 ids to 🔥 , and it's even faster via the CLI and there, exec works fine.
It joins the table events (135 689 items) and metrics (25 125 704 items). And this table contains 31 394 852 items.