drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: ability to disable liveQueries listener during mass updates
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
the useLiveQueries hook is absolutely great but can generate massive drop of performances with expo-sqlite during mass insertions
even by doing a insert with an array of values, the databaselistener will react to every line inserted and any liveQuery responding to this listener will kick in for each line.
I did a synchronisation from an API with 1000+ lines inserted, resulting in 1000+ identical query sent
I wish we could disable the liveQuery with some props. So we could disable it during the mass insertions
Right now, I have created my own "liveQuery" hook based on zustand... each time I insert data in the DB with my DAOs, I update a prop in zustand so every DAO can react to it and kick the refresh. This way it's possible to control when I kick the query.
But it requires a lot of boilerplate and the liveQuery hook is really nice, except for the bad performances due to this missing feature.
Contributor guide
Research direction
Start by tracing the useLiveQueries hook and the database listener behavior in the expo-sqlite integration. Reproduce a mass insertion that triggers repeated live queries, then determine how callers can suppress those reactions during the batch and refresh in a controlled way. Done means bulk inserts no longer cause one query refresh per inserted row while normal live-query behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- databases, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100