On 1/25/07, Ben Supnik <[EMAIL PROTECTED]> wrote:
Hi Y'all, Please forgive what I think is probably a dumb question, but... I am porting my app's data model from C++/STL to sqlite. My goal is scalability - even if I implement my data model in C++ using data structures that give me good O(N) time (e.g. use trees, hash tables, etc.) the whole thing has to be in memory, and adding indexing means a pretty big code churn. My question is: If I take all of the sqlite optimizations I should be taking (saving my SQL query statements in compiled form to avoid recompiling over and over, having enough pages in memory to avoid disk thrash, using transactions to limit disk I/O).... Does anyone have sqlite and STL experience to tel me how the speed of an indexed column of integers in sqlite would compare to a set<int> in C++? (I believe my set implementation uses a red-black tree.)
I think sqlite uses btree internally for indexing, so you might compare the time of a red black tree to the time of a btree to get a rough idea. A lot of people have found the operating system will cache their database table so a disk based database will perform as well as a memory based database in sqlite (as long as you have enough memory for the cache). I wouldn't worry too much about scalability until you've reviewed the limits on sqlite. It will handle some very large tasks right out of the box. Good luck -- The PixAddixImage Collector suite: http://groups-beta.google.com/group/pixaddix SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com