TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PostgreSQL Performance on Raspberry Pi

188 pointsby nreillyabout 6 years ago

18 comments

FlyingSnakeabout 6 years ago
I use postgres on my raspberry Pi 3B as my development server (along with PostgREST and Nginx) and it has served me faithfully for more than a year. Many people are surprised to see the setup and how fast it is to spin up a backend server. The response time is also pretty good and it's amazing to see such a tiny machine pull off such a feat.
评论 #19572381 未加载
hobsabout 6 years ago
I love postrgres, and obviously this is just a test, but for anything where I would use a pi sqlite is insanely good.<p>I use sqlite for full fledged websites with millions of rows with no issue, fast, easy to deploy, easy to move.
评论 #19577586 未加载
评论 #19576731 未加载
rb808about 6 years ago
Hopefully nextgen raspberry pi will take sata or some other storage interface. I think SD cards are the main problem with the platform right now.
评论 #19573904 未加载
评论 #19573394 未加载
评论 #19574713 未加载
评论 #19573214 未加载
评论 #19575062 未加载
评论 #19575373 未加载
MuffinFlavoredabout 6 years ago
For comparison, I ran this on a $80&#x2F;mo OVH dedicated server (SP-32 Server - E3-1270v6 - 32GB - SoftRaid 2x450GB SSD NVMe)<p><pre><code> $ sudo su postgres $ createdb bench_test $ pgbench -i -s 10 bench_test $ pgbench -c 10 -j 2 -T 3600 -P 60 bench_test starting vacuum...end. progress: 60.0 s, 9192.5 tps, lat 1.088 ms stddev 0.924</code></pre>
评论 #19579059 未加载
评论 #19577016 未加载
评论 #19574287 未加载
antirezabout 6 years ago
Redis is quite fast on the Pi3, completely another story compared to the original Pi. With AOF enabled and fsync policy every second, without using pipelining it does 28k ops&#x2F;sec. With pipelining it reaches 80k easily. Not bad for a hardware that is quite cheap and limited. About the problems with the SD card, in the specific case of Redis there are mitigations <i>if</i> it is possible to give up on durability. One could use snapshotting and configure a delay that will not trash the SD too much. I think PostgreSQL does a lot of random access in the on-disk btree, but other systems using some log structured storage in append only should create less problems in theory.
moreentropyabout 6 years ago
Is the limit he found CPU bound? IO bound?<p>I suspect he basically tested some random SD card&#x27;s performance.
评论 #19572288 未加载
dcbadacdabout 6 years ago
Please for the love of god, do not use Postgres on a SD card, you&#x27;ll corrupt it quickly, even spinning rust over USB2.0 is faster and more reliable. That&#x27;s my experience with it at least.
评论 #19573282 未加载
评论 #19574573 未加载
评论 #19575387 未加载
评论 #19573045 未加载
wybiralabout 6 years ago
You better have some good redundancy on those SD cards because I&#x27;ve run Pi clusters before and most of those cards go corrupt pretty quickly with any frequent number of writes.
评论 #19573239 未加载
评论 #19572181 未加载
评论 #19572125 未加载
评论 #19574307 未加载
评论 #19574739 未加载
jxclabout 6 years ago
I&#x27;m wary of running anything with data I care about on a device without ECC RAM.<p>From the docs:<p>&gt; PostgreSQL does not protect against correctable memory errors and it is assumed you will operate using RAM that uses industry standard Error Correcting Codes (ECC) or better protection.<p><a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;11&#x2F;wal-reliability.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;11&#x2F;wal-reliability.html</a><p>Re: IS ECC RAM really needed?<p><a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;20070526145214.GA21290@mark.mielke.cc" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;20070526145214.GA21290...</a>
评论 #19574231 未加载
评论 #19577489 未加载
评论 #19582932 未加载
Abishek_Muthianabout 6 years ago
If the storage is handled properly, RPi can do wonders.<p>I&#x27;ve used RPi1 as a git sever in our company for 5 years with encrypted USB flash drive as storage.<p>We must have committed at-least a million lines of code into it &amp; we were using it every day.<p>Except for changing some memory related flags in git, I didn&#x27;t change much w.r.t to git.<p>I had another encrypted USB flash drive to which the files were backed up, interestingly this flash drive failed but the primary drive never died till date.<p>The git server is running 24*7 on RPi1 for past 5 years.
cat199about 6 years ago
cool article!<p>It would be great to know the SDCard speed and maybe see some comparisons based on the SDCard type since the speeds vary quite a bit<p>see also: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;SD_card#Speed" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;SD_card#Speed</a>
评论 #19572569 未加载
goombasticabout 6 years ago
The amount of problems I have with the SD card on the raspberry pi is crazy. The thing is never stable.
评论 #19574506 未加载
评论 #19573861 未加载
ggmabout 6 years ago
They need to re-test on the grid using different PI for each version. And then re-test using same pi, different SD card.<p>Beecause it is clear from the bad SD card comment that the SD card and PI can influence the speed of the tests.
Nuxabout 6 years ago
Would be interesting to see a pgsql vs mariadb Rpi benchmark.
评论 #19572390 未加载
warmwafflesabout 6 years ago
I&#x27;ve always wanted to make an arm based cluster for kicks and giggles. Just can&#x27;t find a fun project to warrant it.
Tepixabout 6 years ago
I wonder how the Asus Tinkerboard and the Pine64 RockPro 64 (RK3399) compare
contingenciesabout 6 years ago
workloads &gt; RAM ≈ 0 ∴ benchmark = premature optimization # ;)
dijitabout 6 years ago
I only read the title; but I&#x27;m expecting performance generally to be abysmal.<p>I&#x2F;O is quite poor on rPIs and that&#x27;s what PostgreSQL needs more than anything. More than memory or CPU for sure.<p>The best thing you can ever do for your database is (in this order):<p>1) Have enough ram to fit your entire dataset (mostly due to joins)<p>2) Have the best raid card money can buy.<p>--<p>An SD card is shocking enough but on the rPI it&#x27;s going over a USB bridge which takes CPU cycles too!<p>Still probably performs better than postgresql on WSL; since the I&#x2F;O is the major bottleneck there too.
评论 #19572355 未加载
评论 #19572115 未加载
评论 #19572171 未加载
评论 #19572374 未加载