SQLite Forum

Increasing insert performance of an in-memory db
Login
Thanks for this! The inserts were not in primary key order. Changing my code to do inserts in primary key order improved the performance by around 80%. Now `memcpy()` takes around 15% of the time. `malloc()` takes around 75%.

I guess the next step is to play around with `page_size` to see if I can do fewer mallocs? The documentation says that `page_size` needs to be set before the database is created. But how do I do it in case of in-memory DBs? 

Do you have any other ideas about speeding up memory allocation?