Re: Simple join doesn't use index

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Alex Vinnik <alvinnik(dot)g(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Simple join doesn't use index
Date: 2013-01-29 20:06:50
Message-ID: CAMkU=1z9tGDWcf0kdR3_HAzXaSGfqe_=apw+ZysXsOfsJxdOHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Jan 28, 2013 at 3:43 PM, Alex Vinnik <alvinnik(dot)g(at)gmail(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alex Vinnik 2013-01-29 20:43:17 Re: Simple join doesn't use index
Previous Message Merlin Moncure 2013-01-29 19:35:13 Re: Simple join doesn't use index