By ILikeBeer
Hi, I’m using a postgres database deployed as a docker container on a $15/mo Droplet (with swap). I’ve replicated the container for an A vs. B ‘Volume vs local filing system’ speed test.
Where the database files are : [A] on local machine file system/disk <---- takes 10s [B] on a 10GB Volume <— takes 34s
A query on a 7 million row table (see below) takes 10 secs on [A] and 34 secs on [B]
SELECT * FROM ( SELECT val1,val2, cdatetime, a, b, c, d FROM events_table WHERE cdatetime >= ‘2022-01-16T12:26’ AND cdatetime < ‘2022-01-17T15:26’ ORDER BY cdatetime DESC ) as sub_sigevent WHERE sub_sigevent.d = 59 AND sub_sigevent.a = 6 AND sub_sigevent.b = 3 AND sub_sigevent.c = 7
As Volumes are networked memory in effect, I assume this is caused by the slow connection to the Volume compared to local filing system. So it would appear there’s no way round this, other than to try a time series specific data base such as ClickHouse (OSS version of InfluxDB) that scales better.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I was just about to share the link to the same discussion. Indeed as mentioned in that discussion, you will always see a bit worse performance on a Volume compared to local storage, as Volumes are network-based storage which adds some overhead.
You could try doing some tweaking in order to optimize the performance of the Postgres instance itself using the following script:
https://github.com/jfcoz/postgresqltuner
Also, a good related read would be this tutorial here on how to benchmark DigitalOcean volumes:
https://www.digitalocean.com/community/tutorials/how-to-benchmark-digitalocean-volumes
Best, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.