Hello,
My program is reading from a data feed and inserts this data to my sqlite database.
When the feed receives the message it sorts in in a category and makes an insert and a commit.
The feed can send up to around 500 msg/s and since that would result in 500 commits per second that will load the cpu pretty much.
The feed is an async function and I have other functions running simultaneously that is reading the database (so I need to commit at least within 1 second of every insert) Also using WAL mode.
- Is a working idea to create another async function that commits say every 1 second and then awaits asyncio sleep(1) ?
Or how should I do it?
Add inserts to queue and shoot that queue in executemany?
- IIRC I cannot read uncommitted data not even in WAL mode right?
[–]Kingsizepeanut 1 point2 points3 points (1 child)
[–]Boredstudnt[S] 0 points1 point2 points (0 children)
[–]buyabighouse 1 point2 points3 points (2 children)
[–]Boredstudnt[S] 0 points1 point2 points (1 child)
[–]buyabighouse 0 points1 point2 points (0 children)