On Mon, Jan 28, 2013 at 3:43 PM, Alex Vinnik <alvinnik.g@xxxxxxxxx> wrote: > It sure turned out that default settings are not a good fit. Setting > random_page_cost to 1.0 made query to run in 2.6 seconds and I clearly see > that indexes are being used in explain plan and IO utilization is close to > 0. > > QUERY PLAN > Sort (cost=969787.23..970288.67 rows=200575 width=8) (actual > time=2176.045..2418.162 rows=241238 loops=1) > Sort Key: visits.id, views.id > Sort Method: external sort Disk: 4248kB What query are you running? The query you originally showed us should not be doing this sort in the first place. Cheers, Jeff -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance