Storing Data Like REDDIT #sqlite #typescript #gamedev #webdevelopment

preview_player
Показать описание
I wrote a database on top of SQLite to store entities in my MMORPG. I am using Reddit's approach with just two tables "entities" and "data". Let me know if you are interested in EntityDB, I might add some more features, clean up the code and make it open source.

00:00 Intro
00:55 Reddit's database has two tables
02:40 EntityDB demo
04:44 EntityDB benchmarks



Рекомендации по теме
Комментарии
Автор

I really liked your video. I did not check your claims but that was extremely interesting and just the right amount of time.

julesponsaille
Автор

Great video hope you continue with these interesting topic. Good luck❤

mahmoudmohammed
Автор

For those who might happen upon this video, do *not* do this unless you have a small enough dataset that fits in memory. Reddit did it when they were young and stupid, *and* mature kv-stores/graph-dbs/other nosql were not available. For the entity model in a game special case, it's fine as long as you understand the upper scaling limit (and by 'understand' I mean modeled the data and the loads at that limit and characterised performance). KV-store on top of a traditional RDB is, generally and especially at scale, a bad idea.

paulie-g
Автор

Wordpress does the same and it is amazing

mjdev-ip
Автор

This reminds me of the EVA(T) (entity value attribute) storage model that Datomic and related databases have. Cool to see something close to it implemented in SQL form. Thanks for sharing!

WillMruzek
Автор

you will face a problem when querying when there's alot of data like 300k if the player data and items rows is not on the same page the query will be very slow a better approach you need to identify which you do often writing or reading if you write more there's a pattern where you set the data in memory first and a job will copy that and persist it to the disk later the job can be an edge function this can help you on both reading and writing fast there's another pattern is called EventSourcing I think it's the best in your case where you presist all your data as events and there's a Projection that write only the data you display to the user on a ReadModel in a mongodb/redis or any db that is fast in reading and you presist the Write model in sql so this is the source of truth

zedmagdy
Автор

For a pet project, sure but as a sysop, seeing sqlite used like this... Things start to hurt a little. I know, you think "eh, how bad could that design consideration be" but always remember - every dev has regrets




(we'll just ignore the anti-pattern of EAV on an RDBMS while I giggle at the idea of typed entities on a DB that you took the types away from. you're creating your future self more work because present self didn't want to use or write a proper DB abstraction that can automatically generate migrations)

IzzyIkigai
Автор

why not use an actual key value store such as redis?

RyanGosling-bn
join shbcf.ru