Why is Postgres on 64-bit CentOS 6 significantly slower than Postgres on 32-bit CentOS 6 We have some Postgres + PostGIS applications that run well on CentOS 6 32-bit machines.

We've recently been testing them on CentOS 6 64-bit machines, with similar configuration (all our machines are managed by Puppet), and the applications run significantly slower.

Even loading the database schemas take several times as long. (On the 32-bit machines, this takes 7 seconds to load PostGIS, the schema, and fixtures; on the 64-bit machines, this takes 50-110 seconds.)

We initially had the problems with virtual servers, so ran tests on a physical machine and found the same problems. Note that the physical 64-bit machine is slower than virtual 32-bit machines.

The databases are not large at all.

We've experimented with various parameters on postgresql.conf and not gotten any improvement.

Is this a known issue with Postgres or PostGIS on 64-bit CentOS?

If not, how do we diagnose this?
Start by using a current PostgreSQL version, preferably a PGDG build. See http://yum.postgresql.org.

Then compare with the same hardware.

There is no known significant performance difference with 64-bit vs 32-bit PostgreSQL on non-Windows platforms.

Personally, I suspect that the 64-bit CentOS might have transparent huge pages enabled, which does cause severe performance regressions with PostgreSQL. See https://dba.stackexchange.com/a/34169/7788, this mailing list post, and Google.

You might also be having issues with the zone reclaim mode for NUMA; Linux's default works very poorly for databases that use shared memory. Set vm.zone_reclaim_mode = 0 in sysctl.conf and apply the changes.