3

I have a question, result that we have a Raspberry Pi with 1GB of RAM, and we need run a service of database, but we have various resources in the moment run. Now our question is, which database can consume less resources, our app, this app processing data of a web server, but we need more resources to other processes.

UPDATE

Our Raspberry pi is running Ubuntu 2014 LTS as OS.

  • Your question is quite difficult to understand and impossible to answer in its current form. You need to add more detail on which database you use at the moment, and how much RAM you have available to run your database after you've started all your other applications. – goobering Apr 26 '16 at 14:51
  • @goobering: pretty sure the database is going to run on the RPi. – Jacobm001 Apr 26 '16 at 14:54
  • @Jacobm001 That certainly seems to be the end goal. It kind of changes the game a little if the sum total available RAM is 2MB, however, which is why I asked for a little more detail. – goobering Apr 26 '16 at 14:56
  • @goobering: Oh... I misread that to be "how much RAM is on whatever machine is running the DB". My bad. – Jacobm001 Apr 26 '16 at 14:57
  • Jacob's given you a decent starting point for this. But beyond being too broad, it is also 1) Very off-topic here, databases are mostly the same irrespective of what brand of hardware you are using, 2) Significantly opinion based. That people will site different "objective benchmarks" to prove things about their favourite software tends to beg questions about the nature of the benchmark and just lead to argument and demonstrate how "significantly opinion based" this is. I'll give you one too: Don't use Apache Couch, you'll need a cluster of pis... – goldilocks Apr 26 '16 at 15:04
2

Part of this can't be answered without knowing what kind of performance you need out of your database. On the Raspberry Pi, you have a couple mainstream options.

  1. MySQL
  2. PostgreSQL
  3. SQLite
  4. Flat files such as JSON, XML, or even just TXT.

Options 1 and 2 will both use a significant amount of resources. If properly configured, they're probably going to be the fastest databases. MySQL will use slightly less, and is configured to give the best performance for data retrieval. PostgreSQL on the other hand has support for much more complicated queries and is optimized for insertion.

Since you're on an RPi, you can probably get away with using SQLite. Like PostgreSQL and MySQL, SQLite is a relational database, but it's all stored in a single file. There is no separate server processes that consumes resources. It has all the features of the SQL spec, plus a few extras. Though it does come short of PostgreSQL's more robust feature set.

Lastly you could go with option four. If you "need" a database, flat files are probably going to be the least attractive option. They will require the most amount of work from you, but have a relative overhead of 0. I wouldn't recommend this approach for anything other than a particularly small dataset.

| improve this answer | |
  • My personal order of preference here would be 4, 3, 2, 1, although the order of the last two is totally subjective (I've used PostgreSQL a lot more than MySQL). My point about 4, 3, is that any form of SQL is often overkill (and OTOH, often very useful). – goldilocks Apr 26 '16 at 15:08
  • @goldilocks: I agree about options 1 and 2 being interchangeable, which is why I tried to address them together. Although I disagree about SQL being overkill on the RPi. I smell a potential blogpost... – Jacobm001 Apr 26 '16 at 15:13
  • Okay, here's some material ;) I think your objection to #4 (that it is more work) is highly subjective: If you are using a dynamically typed OO language that has good JSON or XML support, it's probably less work, and depending on the nature of the data, may make the whole app much simpler. I always try to think in that direction first, then groan if I decide SQL is really what's appropriate (its big advantage here is probably compactness and search performance). In strongly typed OO languages, it is a bit more work in that you may have to write some generic (but highly reusable) glue. – goldilocks Apr 26 '16 at 15:19
  • @goldilocks: Well, if all you're doing is a basic save and reload, then yes, it is the least amount of work. If you need to search, or relate data, or do analysis on the data, it's more work. – Jacobm001 Apr 26 '16 at 15:22
  • P.S. By "overkill" I meant "You don't really need a RDMS here, you just think you do", not "it is too much for the pi, which can certainly handle SQLite very easily. – goldilocks Apr 26 '16 at 15:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.