From 62e0ccaaa87d2d6da94694208b49db1455b12205 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Fri, 21 Jul 2023 16:02:03 -0700 Subject: [PATCH] update benchmark post with actual final schema --- content/rnd/ulid_benchmarks/index.md | 15 ++++++++++++++- themes/apollo | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/content/rnd/ulid_benchmarks/index.md b/content/rnd/ulid_benchmarks/index.md index 3b93bda..3edf0b0 100644 --- a/content/rnd/ulid_benchmarks/index.md +++ b/content/rnd/ulid_benchmarks/index.md @@ -2,6 +2,7 @@ title = "A One-Part Serialized Mystery, Part 2: The Benchmarks" slug = "one-part-serialized-mystery-part-2" date = "2023-07-15" +updated = "2023-07-21" [taxonomies] tags = ["software", "rnd", "proclamation", "upscm", "rust", "sqlite"] +++ @@ -289,7 +290,6 @@ dropped the total size on disk about 25% (from 17 megabytes to 13), and the perc database consumed by the indexes of the `watch_quests` table went from 51% to 43% (that means the indexes went from being about 8.6MB to 5.6MB, 35% less than when using a composite primary key). - ``` text *** Indices of table WATCH_QUESTS ********************************************* @@ -315,6 +315,19 @@ like that if you wanted to keep track of, you know, when things were created. Ir to implicit integer rowid primary keys for the `watch_quests` table, I had to make sure that there was a `created_at` column for it. Still a win, though! +### *UPDATE (2023-07-21)!* + +Something I realized with the "final" schema is that you could have duplicate rows, since the only +unique field was the `rowid`. I didn't want this. So, rather than create a `unique index on +watch_quests (user, watch)`, I [just +added](https://gitlab.com/nebkor/ww/-/commit/c685dc1a6b08d9ff6bafc72582acb539651a350c) a `primary +key (user, watch)`. + +If that looks familiar, good eye! Doing this brings the disk usage back up to 17MB in the baseline +benchmark, but the insert rate is still the same. In the grand scheme of things, this is still not a +lot of data, so I'll take it anyway. + + ## Next steps with IDs This project is supposed to be more than just a testbed for learning about databases and web diff --git a/themes/apollo b/themes/apollo index eb02b7d..54e1c70 160000 --- a/themes/apollo +++ b/themes/apollo @@ -1 +1 @@ -Subproject commit eb02b7d3c18a397fe5baa394b50fe2c199208dbe +Subproject commit 54e1c70c93ad5fe261a00ddf697856c621d8fc87