I have to share this, a statement that is finished before I even run it ;)
Limit (cost=0.00..527.34 rows=20 width=4) (actual time=0.046..-2.436 rows=20 loops=1)
Output: id, (count(*))
Buffers: shared hit=191
-> GroupAggregate (cost=0.00..12403455.78 rows=470416 width=4) (actual time=0.044..-2.448 rows=20 loops=1)
Output: id, count(*)
Buffers: shared hit=191
-> Index Scan using idx_pid on prodlink z (cost=0.00..12373751.62 rows=5000000 width=4) (actual
time=0.021..-2.578rows=183 loops=1)
Output: id, pid, bid
Buffers: shared hit=191
Total runtime: -2.368 ms <<==== this is amazing ;)
This is with 9.1.1 on a Windows XP machine