Aaron is anything but boring, he makes learning engaging and has given me more than one trick up my sleeve. I have been working with relational databases both professionally and for all my side projects and I've learned things about databases I didn't even know existed. Any course this man produces is an instant auto-buy because he makes it easy to do. You can tell he's put his heart and soul into this course and it'll stick with me longer than the current season of 'The House of the Dragon.' Wow is there any topic this guy can't make fun!Alex Maven
Build with and integrate SQLite into your production applications.
I've made my test data available for you to use and follow along.
This is a quick tip. I'm not even gonna show my screen because there's nothing to show. The tip here is use multiple databases. I'm not talking here about multi tenancy which we'll talk about in the next video. What I'm talking about is splitting up your database by function.
So, in a traditional web app, you would likely have some sort of cute job system and some sort of caching system. In most major frameworks you can have a database persistent layer that backs both of those things. So your queued jobs are all stored in the database and your cached values are all stored in the database as well. Those are pretty common drivers. With any other type of database, that's that's probably fine because you're not, you're not having global right contention.
But with SQLite, remember there can only be 1 writer at a time. And something like a cache or a queue may be a lot higher than your traditional web app. It may have a lot higher percentage of writes than a traditional web app. A traditional web app is like 80 to 90 to 95% reads, but a queue is gonna be a lot higher. A cache is gonna be a lot higher because you're constantly putting jobs in or putting new cached items in.
So when you're using SQLite, to get around that, you should consider creating a queue dot SQLite and a cache dot SQLite database alongside your regular application database that holds, you know, your users and your comments and your to do's and all of that stuff. So this is very this is a very common pattern. I think this is what the light stack for rails does. But when you separate, when you break out those databases, remember databases are are cheap and easy to create with SQLite. When you create that out, or when you, when you break that out, you functionally get the benefit of having 3 separate, like, 3 separate concurrent writers.
1 to cache, 1 to queue and 1 to your app database. And this can serve us, this this framework can serve us quite well. When we move into multi tenancy and we start thinking about having a database per user, you realize that, oh, maybe one tenant is not that busy. All the tenants combined are quite busy, but one tenant is not that busy and maybe we should create a database per tenant which is what we're gonna talk about in the next video.