Skip to main content

Posts

Showing posts with the label postgres

Postgres Index Cost-Benefit Analysis Using the Cumulative Statistics System

Index Overhead Postgres MVCC mechanism creates a new tuple version when a row is updated. This means that tuple updates, barring hot updates, have an amplifying effect on write load in addition to inserts and deletes, because all indexes that contain a pointer to the old tuple version must also get updated. Updates impose another insidious cost on query performance: index-only scans lose efficiency. If a table’s visibility map is stale due to heavy update volume, then index-only scans must fetch heap pages to confirm tuple visibility, nullifying the benefits of the index-only scan. Then, there is WAL logging. To support physical replication, index changes have to be individually tracked in the WAL file along with the heap change if WAL logging is enabled. This is another cost overhead that requires careful consideration of index use. Consequently, a single tuple operation has the potential to turn into multiple write operations depending on just table indexing choices, everything else ...

MogileFS with Postgres

First of all, you need Postgres version 8.2 or newer since mogdbsetup refuses to run with older versions. Anyways, I spent a quite a bit of time trying to install MogileFS with Postgres. I was getting "Can't create temporary test database:" errors. The answer was in the ~/.cpan/build/mogilefs-server-2.34/blib/lib/MogileFS/Test.pm file. The temp_store subroutine was defaulting to MySQL... Here is the setup step by step on my Fedora 12: yum install mogilefsd yum install mogstored yum install perl-CPAN // if needed yum install perl-MogileFS-Client perl-MogileFS-Utils yum install perl-DBD-Pg yum install perl-IO-AIO Setup services. chkconfig --levels 345 mogilefsd on chkconfig --levels 345 mogstored on Setup a test database to be used during compilation. $ createuser -SRlD mogile $ createdb -E UTF8 -O mogile tmp_mogiletest Setup environment variables for testing $ MOGTEST_DBUSER=mogile $ MOGTEST_DBHOST=dbhost $ MOGTEST_DBNAME=tmp_mogiletest $ MOG...