What do you mean by push arbitrary objects?
What do you mean by push arbitrary objects?
structuredClonedINSERT rows.cursor.rowsRead should be accurate, the amount of returned rows isn't a good representation of amount of rows read because query can read more than it returns.A request unit is defined as 4 KB of data read or written. A request that writes or reads more than 4 KB will consume multiple units, for example, a 9 KB write will consume 3 write request units.This is an example on the pricing page explaining how reads (e.g. gets) work. List is the same, but it needs clarification to make sure people know that it's across all items examined/returned.

create cloudflare template with modified code, SQLite backend:Config1 to Config5 are all useless tables, and keeping rest of the code the same.Configs, and the hidden KV API table) and second request costs 8 reads, in the second reproduction there were 7 tables (Configs, Config1 to Config5, and hidden KV API table) and the second request costs 28 reads.<mobile-phone>-<OTP> and value being the timestamp or whatever info you want. When the request comes in you can check the specific OTP if it exists or not indicating validity, and search by prefix the phone number.structuredCloneINSERTcursor.rowsReadcreate cloudflareConfig1Config1Config5Config5ConfigsConfigs<mobile-phone>-<OTP>const cursor = sqlStorage.exec(query, ...values)
const results = [...cursor]
if (logSql) {
console.log({
query,
read: cursor.rowsRead,
written: cursor.rowsWritten,
})
}
return resultsimport { DurableObject } from 'cloudflare:workers';
export class MyDurableObject extends DurableObject<Env> {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
ctx.blockConcurrencyWhile(async () => {
await ctx.storage.transaction(async () => {
const version = await ctx.storage.get('migrationVersion');
if (version === 1) return;
ctx.storage.sql.exec(`
CREATE TABLE Configs (
key TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (key)
)
STRICT;
`);
ctx.storage.sql.exec(`INSERT INTO Configs (key, value) VALUES (?, ?);`, 'foo', 'bar');
await ctx.storage.put('migrationVersion', 1);
});
});
}
async sayHello(key: string): Promise<string> {
const { value } = this.ctx.storage.sql.exec(`SELECT value FROM Configs WHERE key = ?;`, key).one();
return `Hello, ${value}!`;
}
}
export default {
async fetch(request, env, ctx): Promise<Response> {
const url = new URL(request.url);
if (url.pathname !== '/hello-world') return new Response(null, { status: 404 });
let id: DurableObjectId = env.MY_DURABLE_OBJECT.idFromName('hello-world');
let stub = env.MY_DURABLE_OBJECT.get(id);
let greeting = await stub.sayHello('foo');
return new Response(greeting);
},
} satisfies ExportedHandler<Env>;CREATE TABLE Configs (
key TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (key)
)
STRICT;
CREATE TABLE Config1 (
key TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (key)
)
STRICT;
CREATE TABLE Config2 (
key TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY (key)
)
STRICT;
-- Config3, Config4, Config5