Great, looks like they forgot to update the 5 to 10 GB on the pricing page
Great, looks like they forgot to update the 5 to 10 GB on the pricing page
d1-database help channel which support threads? So answered topics can be archived.rows_read in case of counts is completely snowed under...count and get one row read back in SQLite (the query engine D1 uses). Keep in mind you also get 25 billion reads included in the paid plan 
USING COVERING INDEX test_index) takes 0.3s*. I’m not at a computer but try it with D1 (or libsql) so you can see the row counts. Time isn’t accurate.foreign key mismatch - "new_Post" referencing "User" on D1. Any help, please?USER table, even before it gets modified. Something like the below should work:PRAGMA foreign_keys=off is a no-op (per SQLite spec). The defer works, as you can see.
var batch_arr = [];
const delete_r = env.DB.prepare("DELETE FROM table");
batch_arr.push(delete_r);
const stmt = env.DB.prepare("INSERT INTO table (n, v) VALUES (?1, ?2)");
for(var i = 0; i < 100; i++) {
batch_arr.push(stmt.bind( i, 'str' ));
}
const batch = await env.DB.batch(batch_arr);d1-databaserows_readcountUSING COVERING INDEX test_indexCREATE TABLE "Post" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"authorId" INTEGER,
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Post" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"authorId" INTEGER,
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("uid") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Post" ("authorId", "id") SELECT "authorId", "id" FROM "Post";
DROP TABLE "Post";
ALTER TABLE "new_Post" RENAME TO "Post";
CREATE TABLE "new_User" (
"uid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;foreign key mismatch - "new_Post" referencing "User"USERPRAGMA defer_foreign_keys = on;
CREATE TABLE "new_User" (
"uid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE TABLE "new_Post" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"authorId" INTEGER,
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("uid") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Post" ("authorId", "id") SELECT "authorId", "id" FROM "Post";
DROP TABLE "Post";
ALTER TABLE "new_Post" RENAME TO "Post";
PRAGMA defer_foreign_keys = off;PRAGMA foreign_keys=offdefervar batch_arr = [];
const delete_r = env.DB.prepare("DELETE FROM table");
batch_arr.push(delete_r);
const stmt = env.DB.prepare("INSERT INTO table (n, v) VALUES (?1, ?2)");
for(var i = 0; i < 100; i++) {
batch_arr.push(stmt.bind( i, 'str' ));
}
const batch = await env.DB.batch(batch_arr);