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 considerations

76 pointsby mattybover 14 years ago

5 comments

pgr0ssover 14 years ago
Here are a few extra tips:<p>- "select relname, indexrelname, idx_scan from pg_stat_user_indexes" will show how many times an index is used, so you can remove unused indexes<p>- you can create indexes without locking tables (ie, while your site is up) by using "create index concurrently"<p>- you should use the autovaccuum daemon instead of manually running vacuum analyze in most cases
acconradover 14 years ago
This is particularly important if you are working on Heroku. I just made the switch from MySQL to Postgres and while they both run SQL, they have numerous syntactical and performance considerations that need to be addressed so you can transition into the Heroku cloud easier.<p>It's definitely worth considering for 9 and up, as at least when I was in grad school for databases (~2008), MySQL outperformed Postgres.
评论 #2081384 未加载
评论 #2081200 未加载
评论 #2081304 未加载
zzzeekover 14 years ago
I can vouch for the inner joins blowing outer joins out of the water. Setting up your postgresql.conf appropriate to its environment is helpful as well, <a href="http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server" rel="nofollow">http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Serve...</a> has a good deal of explanation.
评论 #2082113 未加载
ghotliover 14 years ago
Put your write ahead logs on a mirrored set of ssds as long as your write patterns can handle a build up of logs before archiving to slower storage. This gets the fsync out of the way so the application will block for a shorter amount of time.<p>Postures relies heavily on disk cache, so be sure to tune shared memory small enough to allow the kernel to cache commonly used disk pages. ZFS on FreeBSD and OpenSolaris has the ARC as a second level of caching between disk cache and slow disk IO. Te Adaptive Readahead Cache can take advantage of some ssds to up access for your hotspots.
评论 #2083525 未加载
duskwuffover 14 years ago
A bunch of these performance tips are equally applicable to any SQL database. MySQL doesn't have partial indexes or GiST, for instance, and it uses ANALYZE TABLE instead of VACUUM ANALYZE, but the rest of the tips apply to it too.