OP-Engineering / op-sqlite

Fastest SQLite library for react-native by @ospfranco
MIT License
593 stars 41 forks source link

Feature request: Interrupt query #168

Closed puelocesar closed 1 month ago

puelocesar commented 1 month ago

I could not find anywhere in the documentation, but how could I cancel a slow query? Is there any way of calling sqlite3_interrupt?

My use case is, user is dragging around the map, I wanted to update the POIs when they finish scrolling. Therefore I would like to cancel any previously running query because its result isn't needed anymore. Does that make sense?

Sorry if this is not the right channel for this.

ospfranco commented 1 month ago

well, given the fact the queries are running in a separate thread, this shouldn't be too much of an issue unless you are really running against some performance issues.

There is no current way of calling sqlite3_interrupt, it would also require a lot of code to handle all the JS objects lifetimes and communication with the JS engine, so not sure this is worth implementing without a strong use case for it.

puelocesar commented 1 month ago

You are right, I was overthinking it, the queries actually run fast enough that it wouldn't even be needed. I'm migrating from RealmJS, which was very slow (around 500ms to fetch my data sometimes), so I thought I was going to need this.