ott
ott
CCConvex Community
Created by ott on 4/17/2025 in #general
Oh is it literally another db table? The
I didn't consider that every query needs to also be on the timestamp because of the optimistic CC, so it makes sense why a b+tree would perform better
6 replies
CCConvex Community
Created by ott on 4/17/2025 in #general
Oh is it literally another db table? The
I did some rough IO estimates for the FIND document WHERE id = <id> AND timestamp <= t (please correct me if I got anything wrong). it looks like they have similar best case scenerios, but the LSM struggles when L0 is tiered. If it was leveled, I think the IO numbers could be pretty similar. key size: 64 bytes value size: 448 bytes entry size: 512 bytes OS page size: 4096 bytes 1 billion entries = 512 GB total storage query: read document/row at timestamp lsm (e.g. rocskdb): - size ratio (T) = 10 - L0 tiered, L1.. leveled - L0 = 10 MB - entries per page = 4096 bytes / 512 bytes = 16 - 1 MB skiplist as the memory buffer - bloom filters with 1% false positive rate - fence pointers on each level/SSTable
| Level | size | num Entries | num SSTables |
| ----- | ------:| -----------:| ------------:|
| 0 | 10 MB | 20k | 1-10 (var) |
| 1 | 100 MB | 200k | 10 |
| 2 | 1 GB | 2m | 100 |
| 3 | 10 GB | 20m | 1k |
| 4 | 100 GB | 200m | 10k |
| 5 | 400 GB | 777m | 40k |
| Level | size | num Entries | num SSTables |
| ----- | ------:| -----------:| ------------:|
| 0 | 10 MB | 20k | 1-10 (var) |
| 1 | 100 MB | 200k | 10 |
| 2 | 1 GB | 2m | 100 |
| 3 | 10 GB | 20m | 1k |
| 4 | 100 GB | 200m | 10k |
| 5 | 400 GB | 777m | 40k |
better case 1. search memory buffer(s): 0 IOs 2. L0 search: 1 IO = 1 IO worse case 1. search memory buffer(s): 0 IOs 2. L0: 10 IOs for each SSTable (they have overlapping key ranges) 3. L1-L5: 1 IO per level (non overlapping key ranges) = 5 IOs. fence pointer cached in memory = 15 IOs b+tree: - leaf nodes: 64 bytes (key) + 8 bytes (pointer) = 72 bytes - non-leaf nodes: 64 bytes + 8 bytes = 72 bytes - ~56 nodes / page - h = 5 better case: 1. all leaf nodes cached 2. 1 IO for value read = 1 IO worse case: 1. 5 IOs for index traversal 2. 1 IO for value read = 6 IOs
6 replies
CCConvex Community
Created by ott on 4/17/2025 in #general
Oh is it literally another db table? The
thanks for answering my questions. I find this stuff super interesting and I'm currently doing database research at uni.
we want to be able to query a snapshot of the index at slightly stale timestamps. this then shifts the workload towards more range scans, which are (often) better on btrees.
for the LSM case, you could have a key of key;<MAX_TS - t> so that keys are sorted most recent first
user:42;990 -> t=9
user:42;995 -> t=4
user:42;999 -> t=0
user:42;990 -> t=9
user:42;995 -> t=4
user:42;999 -> t=0
6 replies
CCConvex Community
Created by ott on 4/17/2025 in #general
Oh is it literally another db table? The
whats the reason for using relational databases instead of kv stores for the storage backend? if everything is a byte string, and the source of truth is a LOG, wouldn't using a LSM backed storage engine be more efficient than a b+tree backed one?
6 replies
TTCTheo's Typesafe Cult
Created by ott on 2/7/2024 in #questions
Creating `AudioContext` in Next.js
There was someone else doing something similar with zustand and audio context in the server (search for AudioContext) which is where I got the idea for the setup on my store, but I want to know if there is a better way.
3 replies
TTCTheo's Typesafe Cult
Created by Brycycle on 12/16/2023 in #questions
TypeError: GoogleProvider is not a function when running with .ts script using tsx
Does it need to be .tsx, afaik GoogleProvider is a react component
6 replies
TTCTheo's Typesafe Cult
Created by ott on 10/17/2023 in #questions
OAuth providers on vercel preview deployments with NextAuth
I didn't end up trying, but if you go to the create t3 turbo monorepo, they have some app called auth-proxy that prob solves this issue
4 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
fair enough
18 replies
TTCTheo's Typesafe Cult
Created by Aidam on 10/17/2023 in #questions
React Native with T3
I used https://github.com/t3-oss/create-t3-turbo, but it took a lot of fiddling with to get pnpm with react native working
4 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
why do you want to render a sheet anyway?
18 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
i don't think its an antipattern, i've mostly just used the mobile dialogue because its works well enough
18 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
something like K in keyof T if K not keyof U and K in keyof T if K keyof U, im not a major typescript expert but chatgpt might be
18 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
18 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
ya, there probably a way to get the intersecting properties and unique properties so you can do something like <Sheet {...intersecting} {...sheetProps}> and <Dialogue {...intersecting} {...dialogueProps}>
18 replies
TTCTheo's Typesafe Cult
Created by Xaohs on 10/17/2023 in #questions
Render either a Sheet, or a Dialog in a streamlined way with Shadcn/ui?
i would make a single component that renders both the dialogue and sheet like
export function DialogueOrSheet({trigger, title, description}) {

return (
<>
<Sheet className="block lg:hidden">
<SheetTrigger>{trigger}</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>{title}</SheetTitle>
<SheetDescription>{description}</SheetDescription>
</SheetHeader>
</SheetContent>
</Sheet>
<Dialog className="hidden lg:block">
<DialogTrigger>{trigger}</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>{title}</DialogTitle>
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
</>
)
}
export function DialogueOrSheet({trigger, title, description}) {

return (
<>
<Sheet className="block lg:hidden">
<SheetTrigger>{trigger}</SheetTrigger>
<SheetContent>
<SheetHeader>
<SheetTitle>{title}</SheetTitle>
<SheetDescription>{description}</SheetDescription>
</SheetHeader>
</SheetContent>
</Sheet>
<Dialog className="hidden lg:block">
<DialogTrigger>{trigger}</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>{title}</DialogTitle>
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
</>
)
}
18 replies