2
20k items is not that big a read.
On EC2, the main things to do are:
- Get as much memory as you can rationally afford; EBS performance is terrible, and you want as much cache as you can manage.
- Make sure your shared_buffers setting is correct; 25% of available RAM is a good starting point.
- Look at the big read with EXPLAIN ANALYZE to look for opportunities to create indexes (but don’t just create indexes without a practical reason; they’re expensive if they are not being used for anything).
- If changing EBS configuration is an option, consider moving to an 8-stripe soft-RAID configuration.
Source:stackexchange.com