<@U01PL2YSG8L> what would you suggest, what's the ...
# community-help
s
@Kishore Nallan what would you suggest, what's the best and robust way to maintain changes to db and updating data in typesense ? is there a preferred way
k
a) What's your primary datastore? b) How frequently does your data change?
s
mysql and 10 15 changes a minute max but might get bigger in future
k
And do you need the data to be available for search immediately?
s
no ...not really
a bit of delay is fine
k
Then I suggest writing a cron that runs every minute or so, just querying your database for changes since the last cron run. That way you can accumulate the changes and do imports.
The only requirement for this approach is that you need to do logical deletes.
The other approach will be to just queue your updates and have a similar daemon or batch job that read from the queue and do the necessary operations.
s
i can do corn method but how will i perform delete with that method ? i'm trying maintaining typesense in my backend so i can just query for all ids and try to match with all ids in the db and perform a delete on the ones that are no more in the db 😕
k
If you do logical deletion in your app you can identify deletions. By logical deletion I mean setting a is_deleted flag.
s
like a is_deleted columns in db ?
k
Yes.
By having both is_deleted and last_updated fields in your DB you can easily find the rows to be updated since the last cron run.
👍 1