What are Durable Objects?
Cloudflare Docs
What are Durable Objects?
A Durable Object is a special kind of Cloudflare Worker which uniquely combines compute with storage. Like a Worker, a Durable Object is automatically provisioned geographically close to where it is first requested, starts up quickly when needed, and shuts down when idle. You can have millions of them around the world. However, unlike regular Wo...
3 Replies
Thanks @lambrospetrou ! This definitely seems like what I need to use, however it still appears that I can at max bind values to the last statement if I run a batch of statements per:
https://developers.cloudflare.com/durable-objects/api/sqlite-storage-api/#exec
Im curious if there's like a security reason for this or something? Like it definitely seems like having the worker and the sqlite on the same box will greatly reduce the latency of doing several different executions as opposed to batching statements, but it seems like an arbitrary limitation.
Is there a good reason why params can only get bound to the last statement?
Going to ask the opposite, why do you need to run a single statement string?
Can you break up each statement into its own
exec()? Performance will still be fast since it's all locally and synchronous.I don't have to, and if the performance hit is negligible im happy to run each as a separate call, I just assumed there was some degree of performance win to be had by batching them. If it's not significant it doesn't bother me to execute them in a loop
Im still curious tho why that is, is it a technical thing, a security thing? If im allowed to know 🙂
that the bindings can only be applied to the last statement