Does D1 plan to provide features to support cost optimization, such as showing how many rows were sc
Does D1 plan to provide features to support cost optimization, such as showing how many rows were scanned by a query?
wrangler d1 insightswrangler today:/query endpoint with multiple statements, is the operation atomic?exec() prepare() -- but prepare doesn't work with multiple statements db-env and db-prodmigrations/0001_init.sql and migrations/0002_init.sql:wrangler.toml, just for maintaining database migrations?migrations_dir key... though, I think having it in its own dir is better for my personal taste anyway, I don't necessarily want the db associated with the same dir as the worker migrations_dir key worked perfectly Right now, deletes are treated as writes.
ON UPDATE RESTRICT, to prevent updates from happening if there's any foreign keys that relies on a field that's being changed?wrangler d1 insightswrangler➜ npx wrangler@latest d1 insights db-enam --sort-by=reads[
{
"query": "SELECT * FROM [Order] ORDER BY random() LIMIT ?",
"avgRowsRead": 2000,
"totalRowsRead": 2842000,
"avgRowsWritten": 0,
"totalRowsWritten": 0,
"avgDurationMs": 3.9992672061928225,
"totalDurationMs": 5682.958700000001,
"numberOfTimesRun": 1421
},
{
"query": "DROP TABLE IF EXISTS \"Order\";",
"avgRowsRead": 13,
"totalRowsRead": 17004,
"avgRowsWritten": 0,
"totalRowsWritten": 0,
"avgDurationMs": 0.35294311926605504,
"totalDurationMs": 461.6496,
"numberOfTimesRun": 1308
},/queryexec()prepare()db-envdb-prodmigrations/0001_init.sqlmigrations/0002_init.sqlnpx wrangler d1 migrations create foo-dev init --env=dev
npx wrangler d1 migrations create foo-prod init --env=prodwrangler.tomlmigrations_dirmigrations_dirON UPDATE RESTRICTCREATE TABLE `experiences` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
CREATE TABLE `experience_owners` (
`experience_id` text NOT NULL,
`user_id` text NOT NULL,
PRIMARY KEY(`experience_id`, `user_id`),
FOREIGN KEY (`experience_id`) REFERENCES `experiences`(`id`) ON UPDATE no action ON DELETE cascade
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
insert into experiences (id, name) VALUES (1, 'owning a house');
insert into users (id, name) VALUES (1, 'some guy');
insert into experience_owners (experience_id, user_id) VALUES (1,1);[env.prod]
build = { command = "worker-build --release" }
d1_databases = [{ binding = "DB_PROD", database_name = "foo-prod", database_id = "id-2" }]
[env.dev]
build = { command = "worker-build --dev" }
d1_databases = [{ binding = "DB_DEV", database_name = "foo-dev", database_id = "id-1" }]