Really fast search functionality SQLite (Turso)?????
I have a lot (150k cities) in my DB and want to build a instantly fast search (the fastest that is possible with minimal effort) is Turso the right thing to consider or are there other options that are better suited for a search functionality?
15 Replies
for sqlite with local reads is fine
+ indexing
you can also use browser indexed data to avoid the roundtrips
what is that?
MDN Web Docs
IndexedDB API - Web APIs | MDN
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solut...
fine? can you name other technologies that would be faster?
purpose build solutions
idk your data shape
but then I have to send the whole search data to the client. I tried that out for fun and it slowed so much things down
it comes from a json file (I use a city dataset from the internet/api and put it into my db)
then just indexing is fine
but you should benchmark either way
ok, in my benchmark with which I will benchmark the different technologies which ones do you think I should benchmark?
local db / external db
what % of the total request is the round trip? with sqlite you can get < 1ms requests (kinda but you get the idea)
the performance of the query on a avg dataset
after you have the two numbers, you can check the one that makes more sense
because if with sqlite you get faster requests to the db but slower queries, is it worth to add the external db with faster query?
I'm hosting my Next.js app on Vercel, so I will need to host the db somewhere else
Right?
yep
you cant use the file system on lambdas or edges
you need a render source (where the lambda is located) close to the database
you can use cloudflare d1 but its too much of a fuckery to be worth it
interesting. sooo?
benchmark stuff
its boring but you dont have that much options when using vercel
ok, my options are?
use a sql database close to where the lambdas are running
make sure the queries being executed are fully optimized