| ▲ | evilmonkey19 3 days ago |
| Personally I use SQLite in production environments and I don't regret it at all. I don't use Go (I develop in Python - Django mainly) and it has been the best decision ever: no management overhead, easy to backup, no need for difficult environments, etc. I feel like SQLite is undervalued. I do agree that in particular cases might not be the best, but more often than not I see that SQLite is more than enough database. Using Postgres or MySQL for the sake of being "production grade" is never a good idea. SQLite is also production grade. Watching at the statistics (look at sqinn) I would state that 90% of the internet could use SQLite without any issue and only benefits. |
|
| ▲ | h4kor 3 days ago | parent [-] |
| The main reason I use postgres instead of SQLite is that I have multiple processes accessing the database, often 1 web service for API/Website and a worker running in the background doing heavy tasks (e.g. image processing). Both need access to the database and SQLite will run into locking issues. How do you overcome this with SQLite and Django? |
| |
| ▲ | mrklol 3 days ago | parent [-] | | Afaik the fix for that is to have multiple read only connections and one write only connection. | | |
| ▲ | Sammi 3 days ago | parent [-] | | Yes by enabling the write ahead log feature: https://sqlite.org/wal.html It's on by default in many sqlite drivers because it really is the best default. But it isn't on by default in upstream sqlite even though it's been out for ages now. | | |
| ▲ | sgt 3 days ago | parent [-] | | Sure but if you're dealing with WAL logs, why not just go Postgres? Then you also get a port you can connect to from remote machines if you need. | | |
| ▲ | wild_egg 3 days ago | parent [-] | | > "dealing with WAL" What's there to deal with? You turn it on with a pragma and forget about it. | | |
| ▲ | sgt 2 days ago | parent [-] | | Sure but once you have WAL logs, you suddenly have a more heavy weight setup. Backing it up you'll want to back up those WAL logs to achieve proper point in time recovery, and so on. My point is, you're now bolting on extra stuff on it to do things that Postgres can do (which can be pretty light weight). Not disrespecting SQLite, still one of my favorite DB's. | | |
| ▲ | wild_egg 2 days ago | parent [-] | | What? Why are you backing up the WAL? sqlite3 source_database.db ".backup backup_database.db"
Now the WAL content is rolled into your new backup file. Stick a timestamp in the backup file name and run this as a cron job every N minutes and you have all the recovery you need. Another one-liner to sync to S3 and you're all set.Edit: And just to clarify, that command can be run on a live DB as it's being used by your app server. SQLite handles external concurrent readers just fine. | | |
| ▲ | sgt a day ago | parent [-] | | Thanks for the tip, that will work fine as long as the WAL content is rolled up. |
|
|
|
|
|
|
|