I don't really care if it's NoSQL or SQL based - as long as it uses int indexes (and stores them in RAM for fast searching) so I can find my data with simple queries based on criteria like user_id
, lat
, status
, or other common int fields. The actual records can be stored on disk.
My first guess would be SQLite - but it moves slowly when dealing with a lot of concurrent writes.
Second, it also needs to be able to run in very small amounts of RAM for VPS with limited resources. This excludes MongoDB since it spreads to fill all available RAM (well, the diskcache does really). I also can't use MySQL Innodb since it uses about 100MB of RAM just to load and MyIsam doesn't support ACID.
So are their any RDBMS or NoSQL databases that meet all four requirements?
Update: When I say small databases, I mean databases that only use 8-60MB of RAM. I understand that actual data will increase this but most of my datasets are usually under 1GB for the smaller sites with about 5MB of indexes that would need to be stored in RAM. So an ideal database would use about 30MB when running with a fully index dataset of about 1GB. Take this site for example, I doubt the whole stackoverflow site takes much more than 1GB to store.
Update: To clarify, a setup would ideally store all data on disk. However, it would also keep column indexes in RAM (just ints after all) which would contain the needed pointers to data on the disk. This would avoid two things 1) keeping unneeded rows in memory like redis and 2) keeping indexes on the hard drive slowing searches (SQLite).
An example is MySQL which can be configured to only keep primary and secondary indexed columns in memory and all other data on the hard drive. However, MySQL either uses 100MB extra RAM just to add InnoDB or you forgo ACID compliance and stick with Myisam which is not transaction safe.
Again, the target is systems that are limited in RAM and can't handle more than a couple Megabytes of cached indexes - but that still need to allow frequent writes/updates of normally small data sets in a safe manner.
Update: apparently finding something that meets all these requirements is a bit much. So, starting with the most important features let me list them in descending importance.
- Low memory usage
- Indexes (or something to mimic them)
- Handles concurrent writes
- ACID
Expanding on #1, it is more important that data can be written than that reads are fast. Which also means that the amount of RAM should not have any affect on the amount of data that can be stored.
Expanding on #2, ideally (given how small they are) indexes should be stored in RAM since indexes should be nothing more than int values that are compared to filter results before actually accessing the disk for the data.