After asking on pgsql-performance list, Jeff Janes figured out that the cause was associated to the default collation used by Postgres (see this link for more informations). MacMini was using the much performing collation while Dell T420 was using the en/US collation.
T420 (Postgres 9.4.1)
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
pen | pen | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
MacMini (Postgres 9.0.13)
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-------------------+------------+----------+-----------+-------+-------------------------
caldav | caldav | UTF8 | C | C |
collab | collab | UTF8 | C | C |
device_management | _devicemgr | UTF8 | C | C |
pen | pen | UTF8 | C | C |
postgres | _postgres | UTF8 | C | C |
roundcubemail | roundcube | UTF8 | C | C |
template0 | _postgres | UTF8 | C | C | =c/_postgres +
| | | | | _postgres=CTc/_postgres
template1 | _postgres | UTF8 | C | C | =c/_postgres +
| | | | | _postgres=CTc/_postgres
(8 rows)
After setting collation on T420 "C" the A transaction went from 195 seconds to 33 seconds against 40 seconds on Mac Mini; B type transaction went from 141 seconds to 78 seconds against 101 seconds on Mac Mini.
This is the best performance improvement after modifing BIOS settings. Many kernel adjustments didn't provide significant improvements.
So, running the following command will initialize a new database with collation C and encoding UTF8:
/usr/local/pgsql/bin/initdb -D /path/to/your/data --no-locale --encoding=UTF8
I hope this post will help other people in the future. After reading about a lot of digressions about kernel, virtual memory, RAID controllers, disk cache, WAL and other tech stuff I never found someone talking about collations.
Best Answer
See the docs for ALTER TABLESPACE.
Since version 9.6, you can set "effective_io_concurrency" on a per-tablespace basis. You can do so for "random_page_cost" long before 9.6.
These changes have to be made inside the database itself. For discoverability purposes, I would also add a comment inside postgresql.conf near the global settings, saying that they have been tweaked per tablespace. Otherwise, it is not very obvious that these changes have been made.