Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Which is better for low RAM systems: MariaDB or Pg?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Which is better for low RAM systems: MariaDB or Pg?

raindog308raindog308 Administrator, Veteran

In this specific case, a RPi 3 with 1GB of RAM running Debian bullseye.

I have an app which has multiple pieces working at once so sqlite isn't an option.

Comments

  • I wouldn't say it matters a lot - you can just change buffer sizes to tweak RAM usage.

    For PostgreSQL I recommend this tool to generate config suited for your CPU+RAM combo
    https://pgtune.sainth.de/

    If you want low RAM usage then type RAM value lower than 1GB (for example 512MB) into calculator.

    I've never compared psql vs mariadb/mysql in terms of RAM usage, but I had no problems with either on 768MB VPS.

    Thanked by 1khalequzzaman
  • Out of the box, maybe MariaDB. With tweaks, especially for your particular workload, it could go either way.

    If it is for your own projects then better optimisation of your table/index arrangements and your queries will yield much more difference than the engine in use, as you work to reduce page accesses so your common working set is less likely to ever need to be read from storage.

    If you use certain more advanced features like CTEs Pg will start to give you a bit of an edge, but again your overall design will be more significant.

    For other people's software you'll need to seek out benchmarks. 1Gb is large enough that neither is going to win out overall simply due to the memory limits unless the software is particularly optimal on one or the other in low memory.

    Also if your workload is such that the common working set (which is often far from all the data) can practically live in RAM most of the time, the CPU is going to be your main bottleneck by far on a Pi3, followed by IO speed (which should affect both PG and MariaDB equally) when bulk data reading from storage is needed.

    Thanked by 1raindog308
  • Postgres has greater overhead in terms of memory for each connection it opens, so perhaps MariaDB is lighter I think. If you go with Postgres use pgbouncer in front of it

    Thanked by 1lanefu
Sign In or Register to comment.