An example would be a database per user. All a single customers data would be on their own DB with their own limits and you dont need to query anything but their own DB to get their data
Damn this might be ideal for my use case, I've got "organisations" so that way each organisation could have their own db damn! Thank you, just gotta figure out how to make it now lmao
Yeah, the main issue currently (but it's been mentioned they are working on a fix) is having the binding attached to the DB, as each org/db would be it's own binding and you cann't dynamically allocate them
Do also consider you can use other products at the same time, you don't have to store blobs or JSON in the db if you don't need it in a query. KV, R2, etc. exist.
Well the situation is a bit like this, we were currently using KV but we are moving towards a platform meaning if we fetch for example users we would get everyones users, making it slower, etc. Thats why I thought a SQL type database would help. Not sure though
What things would you not put on the db but on other service for example, i'm aware of objects/files I was planning on using cloudflare images/R2 but maybe you have some suggestions?
Just thinking out loud here but if I were to create the database manually before hand, when in my case a new organisation register check for the first empty database and assign that way. You reckon that would be possible?
Not quite, since the D1 Layer that is on top of SQLite handles simultaneous connections. It can't actually process multiple requests simultaneously, but it can store requests in a queue. I would note too that while you can use D1 outside of Cloudflare, it isn't meant to be used that way, and thus it is a bit unergonomic
They do. No matter the underlying protocol, an outgoing I/O op is counted as a "request"(though opening a TCP socket is a single connection, even if you do multiple things with it)
As I undertood, this is mostly limits impose by cloudflare that can be increased by a request or paying. But not about the technology the database uses, right?
Not necessarily. While some of the limits are applied by Cloudflare directly, others are in place because the database may not be stable above those limits. You might be able to push it farther, but CF can't guarantee that it will function correctly, so you can't raise the limit that far