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

> but....the SQLite file is locked against reads while writing in order to achieve serializable isolation.

Not with WAL: https://www.sqlite.org/wal.html



And even without WAL (which you should absolutely be using if you're serving web content with SQLite) the lock for most writes lasts for a tiny fraction of a second.


small writes, which is still a dramatically larger pause than simply copying a few files to a directory and not pausing anything. if the website update is hundreds of large files, then the SQLite write is going to be large also. it then comes down to, "is it faster to copy 200M of files to a filesystem or write 200M of new data to BLOBs in a single monolithic SQLite file?" I'd bet the former in that race


YMMV depending on the exact setup but SQLite is usually faster for many small BLOBs than the filesystem, https://www.sqlite.org/fasterthanfs.html


I might be misremembering, but if you're using a transaction like in the article but using the rollback journal mode rather than WAL, won't sqlite actually hold the lock on the database for the entire time until the transaction is committed, which might actually be a substantial amount of time if you're writing lots of blobs like in the article even if each individual blob doesn't take that long?




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

Search: