A single query still returns the same result. There is too little information about updates in the official documents. I’m not sure if I wrote it correctly.
Is there any way to interleave two tables on disk? I have a table that has a 1 to many relationship with another table. I'm never going to query the "many" table to ask if it connects to the "one" table, always the other way around. I'd like to tell Cloudflare that they can optimize it by keeping the records from the 1 table next to the corresponding records from the many table by interleaving the rows on disk. That way it only needs to pull 1 disk block up when I query for data. Is this possible?
Also, any way to bump up the 2 GB limit? Ikr it's not production ready, but I'd like to use it for a purely non-profit idea and I'm not sure if I'll stay under that limit
D1 is built on SQLite, so this is only possible if SQLite itself contains such a feature. I don't think it does. But at the same time, I suspect this kind of feature would not have so much benefit given we're running SQLite backed by a local SSD. It'd be more important for a distributed database that might split data across many machines, but D1 doesn't do that.
D1 is currently single location (either close to where you are when you create your DB, or in a geographic area of your choosing selected when you create the DB).
We are working on replication for D1, but even when it is replicated, each replica will store the entire database, so there's no need for a query to gather data from multiple machines. We might later add support for sharding, which puts different data on different machines, but we'll likely do this based on an explicit shard key provided by the application, so you'll be able to control which data lives together using shard keys rather than by interleaving tables.
I created a database and chose a location in asia pacific. But why is the latency still so high? It even took up to 1 minute just to view the home page of my web application.
I am in Indonesia and My Web Application targets Users from Southeast Asian Countries.
I have selected the right location for My Database but the Latency is still so High. I don't know where in the Asia Pacific Region the D1 Data Center is located.
The temporary solution is to PATCH the settings of your worker to attach new bindings ( REST API ) and then you can uses D1 through without the REST API
Is there a way to "reset" a database (ie. get it into the same state as if just created). This would be helpful with prototyping where I would like to reset the database and run the single migration I have that I'm editing. Currently, I'm deleting the database, creating another a new one with the same name, binding it to the pages app, updating the database id in the wrangler.toml, and finally applying the edited migration. Would be great to simply reset the database and then apply the edited migration. With local dev, I delete the directory. Longing for a way to reset databases in the cloud
D1 DBs are only accessible via bound workers or via the API/API Tokens you make. The only Workers that can access them are ones which are bound. IP Restrictions would be something you could do in the worker/firewall level