Earlier quoted context omitted.
No, you're seeing a surge in interest for SQLite because people like relational databases, but the n-tier architecture is sometimes not the right solution for the problems people have. And again: many of your arguments have been applied to MySQL, but nobody can with a straight face say it's not a "real" backend database. (To a first approximation ~nobody is interested in SQLite because it lacks correctness or rigid t…
I think that most applications are written for their database. Their database defines their application. If you write your application on a flimsy database then your application becomes equally flimsy. All of your business constraints become flimsy because your source-of-truth (the database) is flimsy. SQLite is flimsy by design.
SQLite on Rails: The how and why of optimal performance
71–80 of 98 posts
Re: SQLite on Rails: The how and why of optimal performance
#72Earlier quoted context omitted.
Yeah, this almost never happens in practice. It’s not even worth being concerned about.
Happened all the time to me before I did some tuning Depends how much write contention you have and how long open transactions take to finish.
Re: SQLite on Rails: The how and why of optimal performance
#73> By design, the sqlite3-ruby gem does not release the GVL when calling SQLite. For the most part, this is a reasonable decision [...] Following the issue comment link https://github.com/sparklemotion/sqlite3-ruby/issues/287#iss... , it sounds like they they had a suspicion about a significant cost of reacquiring the lock but didn't validate it. Sounds iffy especially given all this workaround effort. I feel in eg Py…
Re: SQLite on Rails: The how and why of optimal performance
#74Re: SQLite on Rails: The how and why of optimal performance
#75Feature request: a similar article for other DBs, starting with PostgreSQL.
Re: SQLite on Rails: The how and why of optimal performance
#76General SQLite question for the group… I’m making a FOSS analytics system, and ease-of-installation is important. I want to send event data to a separate SQLite database, to keep analytics data separate from the main app’s data. I’m concerned about scaling, since even a modestly busy website could have 1000+ events per second. My thought is to store events in memory on the server and then make one batched write every…
Write events in parquet format and use DuckDB for your analytics?
Do you mean periodically flushing a queue of logs into a new parquet file (e.g. named with a timestamp)?
Re: SQLite on Rails: The how and why of optimal performance
#77Awesome, I'm always glad to see when someone figures out integration problems and helps the rest of us. I hope he manages to get these fixes into the default Rails confug. I run a Rails app; I switched to Postgres years ago and never looked back. Postgres is awesome. Still, it's great to have alternatives available, and I use sqlite for other tasks, so I know it has good capabilities too.
Re: SQLite on Rails: The how and why of optimal performance
#78Earlier quoted context omitted.
Write events in parquet format and use DuckDB for your analytics?
This. If you’re looking for something portable, DuckDB is hard to beat. It’s pretty much the SQLite for analytics. I’ve had good experience with ClickHouse, too, but it feels a bit more like Postgres rather than SQLite in terms of portability.
https://clickhouse.com/docs/en/chdb
https://clickhouse.com/docs/en/operations/utilities/clickhou...
Re: SQLite on Rails: The how and why of optimal performance
#79If you're using SQLite on Rails are you effectively constrained to one machine/server?
No, you can set up replication with, eg LiteFS where you have one writer and multiple read replicas. That said, then you have operational overhead that defeats a part of the purpose with SQLite. In practice, you can get very far with a single machine and many CPUs (Postgres is ironically a good example of this). In eg Go you can easily parallelize most workloads. In rails, I don’t know if that’s possible. A quick sea…
So, you aren’t limited to single machine, but you should stay single machine as long as possible and extract as much value from that operational simplicity before you trade that simplicity for some kind of horizontal scale
Re: SQLite on Rails: The how and why of optimal performance
#80Earlier quoted context omitted.
First off, I don't know that Richard Hipp agrees with you about what roles SQLite is "meant" to be in. Second: the reasons are straightforward: * For read-heavy access patterns, SQLite is crazy fast. * It's fast enough that you can often simplify your database access code; for instance, N+1 queries are often just not a problem in practice. * SQLite removes a whole tier from the N-tier architecture, which in turn remo…
> I don't know that Richard Hipp agrees with you about what roles SQLite is "meant" to be in. If Hipp thought that SQLite was suitable for backend applications where the database is the authority then he would allow real types and the associated constraints. But he won't do that because it complicates the code and bloats the embedded object size. SQLite is great for what it is. But it's not a real concurrent backend…
People are successfully using it server-side, in specific situations it appears to be a good fit.
> You can accidentally write a string to an int column
Yes, you need more validation logic client-side in exchange for the performance gain. It's a trade-off, not a black/white distinction. A strongly typed language can help here.