Thread: SQL Lite
View Single Post
  #8  
Old 02-10-2011, 06:45 AM
sage_chaozu sage_chaozu is offline
Registered User
sage_chaozu's Avatar
Join Date: Feb 2002
Location: Florida, USA
Posts: 143
sage_chaozu will become famous soon enough
Send a message via ICQ to sage_chaozu Send a message via AIM to sage_chaozu Send a message via MSN to sage_chaozu Send a message via Yahoo to sage_chaozu
Quote:
Originally Posted by WhiteDragon View Post
I think this is a little overly general.

To refine it a little for anyone who is interested:
  1. Indexes are stored in memory. This means that looking up the rows you need will be fast, only reading it after finding it will be slow.
  2. But, even reading the rows won't neccessarily be slow either, since SQLite keeps a cache of a bunch of rows in memory at all times. When reading hot (frequently/recently accessed) data, it'll be from memory.
Similarly, writes are done into memory, and the way Graal's SQLite stuff is set up is that it doesn't wait to write to disk before returning. So a write will just take as long as writing anything into memory.


But even with this, if you need the guarantee that something will be in memory, it's a good idea to keep it in a regular ol' client variable since you may not want the lag if the data is cold and its needed for something important (e.g., sword strength or something which needs to be there in real time).


But yeah, complexity. It may not be worth all this.
Then what would one use a SQL lite database for? It's starting to seem like a lost cause due to performance issues. Then again this does guarantee secure data storage and manipulation. I believe this is due to SQL transactions actually locking the DB table before writing to avoid overwriting.

Hopefully if I keep this simple and everything organized it will all fall into place.
Reply With Quote