$ psql -c "create table t1 (id1 int, id2 int, primary key(id1,id2));" $ psql -c "create table t2 (id int primary key);" $ echo explain select id1,id2 from t1 group by id1,id2 > test1.sql $ echo explain select id from t2 group by id > test2.sql $ echo explain select t1.id1,t1.id2 from t2 inner join t1 on t1.id1=t2.id group by t1.id1,t1.id2 > test3.sql Unpatched $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 575640 latency average: 0.104 ms tps = 9593.939398 (including connections establishing) tps = 9594.358669 (excluding connections establishing) $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 574034 latency average: 0.105 ms tps = 9567.199370 (including connections establishing) tps = 9567.619227 (excluding connections establishing) $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 575861 latency average: 0.104 ms tps = 9597.621429 (including connections establishing) tps = 9597.987750 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 607331 latency average: 0.099 ms tps = 10122.117202 (including connections establishing) tps = 10122.488864 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 607250 latency average: 0.099 ms tps = 10120.749500 (including connections establishing) tps = 10121.116893 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 596696 latency average: 0.101 ms tps = 9944.892891 (including connections establishing) tps = 9945.241139 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 335137 latency average: 0.179 ms tps = 5585.556063 (including connections establishing) tps = 5585.808260 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 332844 latency average: 0.180 ms tps = 5547.358857 (including connections establishing) tps = 5547.622552 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 333560 latency average: 0.180 ms tps = 5559.307483 (including connections establishing) tps = 5559.525508 (excluding connections establishing) Patched: $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 538142 latency average: 0.111 ms tps = 8968.993272 (including connections establishing) tps = 8969.321697 (excluding connections establishing) $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 536532 latency average: 0.112 ms tps = 8942.140535 (including connections establishing) tps = 8942.558895 (excluding connections establishing) $ pgbench -n -T 60 -f test1.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 533906 latency average: 0.112 ms tps = 8898.379053 (including connections establishing) tps = 8898.705040 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 606832 latency average: 0.099 ms tps = 10113.781374 (including connections establishing) tps = 10114.156100 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 599303 latency average: 0.100 ms tps = 9988.336721 (including connections establishing) tps = 9988.803529 (excluding connections establishing) $ pgbench -n -T 60 -f test2.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 599764 latency average: 0.100 ms tps = 9995.966540 (including connections establishing) tps = 9996.330570 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 331786 latency average: 0.181 ms tps = 5529.730263 (including connections establishing) tps = 5529.957450 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 334874 latency average: 0.179 ms tps = 5581.180591 (including connections establishing) tps = 5581.387008 (excluding connections establishing) $ pgbench -n -T 60 -f test3.sql transaction type: Custom query scaling factor: 1 query mode: simple number of clients: 1 number of threads: 1 duration: 60 s number of transactions actually processed: 334198 latency average: 0.180 ms tps = 5569.911710 (including connections establishing) tps = 5570.094872 (excluding connections establishing)