Hacker News new | past | comments | ask | show | jobs | submit login

SQLite is amazing. I wonder if it's usable as a replacement for Postgres for web apps, I'm not sure what happens when multiple processes try to write to it.

Regardless, this is a very interesting project, good job.




Multithreaded use is not supported. SQLite is not a replacement for Postgres—Postgres supports many advanced data structures (lists!), SQL commands, and is faster. But in certain cases, it is enough, and of course setting up SQLite is much easier.


> Multithreaded use is not supported

To be more precise, it's perfectly legal to use SQLite from multiple threads or processes at the same time. It will use its own mutexes and OS file-locking operations to ensure that at any given time, a database is being accessed by either a single writer, or an arbitrary number of readers.

In my opinion, the bigger issue is that clients can only safely access a SQLite database if it exists on a local filesystem. As soon as you decide you want to run multiple web servers, you're in trouble.


Sorry, yes, that's what I meant. I use it for a mostly-read-only Web app, but wasn't sure if it's a disaster waiting to happen. Good to know it's a viable alternative to postgres in multithreaded or multiprocess scenarios.


I ran it as a replacement for MySQL for 3 years, light usage php web app, around 100 - 200 users I guess.

It saved me quite some hassle and reduced the attack surface compared to MySQL.

FWIW I never bumped into speed issues. My biggest issue against it is that it would let me alter columns directly which effectively sabotaged my use of alembic when I started using Python/flask.


Huh, that sounds like it worked very well. Plus, the reduced overhead of backups etc is definitely worth it for small apps.


Here is more information on the concurrency-related features of SQLite to complement teraflop's sibling comment: http://sqlite.org/threadsafe.html


It's a good database in its own right. Use a write-ahead log, and you can get one writer and as many readers as your local disk can support.

The common thinking is that it's more of a replacement for fopen than it is for Oracle.




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

Search: