Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A bit off topic, but there seems to be quite a few SQLite experts here.

We're having troubles with memory usage when using SQLite in-memory DBs with "a lot" of inserts and deletes. Like maybe inserting up to a 100k rows in 5 minutes, deleting them all after 5 minutes, and doing this for days on end. We see memory usage slowly creeping up over hours/days when doing that.

Any settings that would help with that? It's particularly bad on macOS, we've had instances where we reached 1GB of memory usage according to Activity Monitor after a week or so.



Are you running vacuums at all? auto_vacuum enabled at all?

https://sqlite.org/lang_vacuum.html


In memory DBs don't have anything to vacuum.

However... what you (and OP) are looking for might be pragma shrink_memory [1].

[1] https://sqlite.org/pragma.html#pragma_shrink_memory


Ah, you're correct. I read too fast and missed that it was in-memory databases specifically!


If you're deleting all rows you can also just drop the table and recreate it.


sounds like normal behavior of adjusting buffers to better fit the usecase, not sure if it applies to sqlite or if sqlite even implements dynamic buffers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: