Replies: 7 comments 16 replies
-
Anecdata:
@KyleAMathews, @samwillis, @quolpr -- have you guys run into any performance walls with SQLite in the browser once you have a sizeable dataset? I mean it isn't horrible but it doesn't seem fast enough to drive a reactive UI once the tables have 10k, 100k + rows. Even when indexed. |
Beta Was this translation helpful? Give feedback.
-
Linking @AlexErrant's perf problems with SQLite: vlcn-io/js#27 @AlexErrant - do you have any other anecdotal or hard data where you've hit performance walls with SQLite in the browser? |
Beta Was this translation helpful? Give feedback.
-
Some more anecdata -- in-memory sqlite vs js memory: https://youtu.be/I6n65YlBWfA |
Beta Was this translation helpful? Give feedback.
-
An interesting thing to compare would be how long do the same actions (seeding, limit, filter, etc) take with native sqlite (in-memory + disk). If in fact those are significantly faster than browser WASM, then perhaps the WASM build is missing some optimization. |
Beta Was this translation helpful? Give feedback.
-
I need to do some more benchmarking on querying large datasets, but I can comment on impact of We have found that when doing large inserts (NNk rows in one transaction) and enforcing foreign key relations causes up to 100x slow down. If you can be sure that your insert does not have invalid foreign keys, temporarily setting @tantaman, the seeding demo, is it seeding multiple tables - issues and comments? On a somewhat related note, you can also get a 10% speed up on large inserts by sorting the rows in JS by the foreign key value first, before the insert. I suspect this is helping with building indexes, but that's a guess at this point. |
Beta Was this translation helpful? Give feedback.
-
Here's an Observable notebook that does some micro-benchmarking of SQLite reads/writes against vanilla in-memory interactions: https://observablehq.com/@tantaman/in-memory-sqlite-perf
|
Beta Was this translation helpful? Give feedback.
-
I'm quite interested in the possibility of using materialite as a layer in front of a sqlite database. This could be with it embedded into an ORM or with a SQL parser that translates (a subset of) SQL into a materialite query. Ideally the workflow would be something like:
I think it would be more than fine to only support a subset of SQL queries, and then fallback to a full refresh from the database when the query isn't supported. I don't see the performance of SQLite itself being an issue, it's the potential speed up of being able to skip a full re-query that makes materialite so exciting. With the above workflow you could have very large datasets that your don't want to fully load into memory, but continue to have the incremental result updates that materialite enables. Is this something that you think is possible? A couple of thing to consider:
|
Beta Was this translation helpful? Give feedback.
-
This is just a scratch pad of threads to pull on and not a rigorous investigation yet.
The purpose of this is to collect evidence to decide between:
Non performance related considerations (draft): https://github.com/vlcn-io/docs/blob/main/pages/blog/sqlite-isnt-it.mdx
Threads to pull on:
statements
path.Related:
Updates:
12/27/2023 - Micro benchmarks
Beta Was this translation helpful? Give feedback.
All reactions