SQLite's `optimize_table()`
#1
It looks like SQLite's optimization works on the database level but not the table level.

But MyBB's using VACUUM is working on tables rather than databases/schemas, which is wrong: https://github.com/mybb/mybb/blob/mybb_1...e.php#L923

Thus, this function does fail when the VACUUM query tries to closeCursor() in https://github.com/mybb/mybb/blob/mybb_1...e.php#L924

I'm not sure if VACUUMing on a large SQLite database file might be good, as explain in https://sqlite.org/lang_vacuum.html#howvacuumworks such process will generate a temporary db file and not to mention the function is usually called several times to optimize tables

Further, since the function is intended to run over tables, we may pass SQLite's implementation for it and add another optimize_db() function dedicated to SQLite for maintenance usage, such as Database Optimization and Database Backup. However, currently MyBB doesn't have database information such as database name stored in the DB object, it wouldn't be easy to implement such optimize_db() function. It'd be better to defer this part to 1.9.
Could be wrong but worth a try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)