Re: Simple join doesn't use index - Mailing list pgsql-performance

From Jeff Janes
Subject Re: Simple join doesn't use index
Date
Msg-id CAMkU=1z9tGDWcf0kdR3_HAzXaSGfqe_=apw+ZysXsOfsJxdOHw@mail.gmail.com
Whole thread Raw
In response to Re: Simple join doesn't use index  (Alex Vinnik <alvinnik.g@gmail.com>)
Responses Re: Simple join doesn't use index  (Alex Vinnik <alvinnik.g@gmail.com>)
List pgsql-performance
On Mon, Jan 28, 2013 at 3:43 PM, Alex Vinnik <alvinnik.g@gmail.com> 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


pgsql-performance by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Simple join doesn't use index
Next
From: Alex Vinnik
Date:
Subject: Re: Simple join doesn't use index