Re: Slow query (planner insisting on using 'external merge' sort type) - Mailing list pgsql-performance

From Ian Pushee
Subject Re: Slow query (planner insisting on using 'external merge' sort type)
Date
Msg-id 55842DF1.9040208@intuvisiontech.com
Whole thread Raw
In response to Re: Slow query (planner insisting on using 'external merge' sort type)  (Andreas Kretschmer <andreas@a-kretschmer.de>)
Responses Re: Slow query (planner insisting on using 'external merge' sort type)
List pgsql-performance

On 6/19/2015 10:47 AM, Andreas Kretschmer wrote:
>> Explain Analyze outputs (links as requested):
>> Default plan: http://explain.depesz.com/s/ib3k
>> Forced index (random_page_cost=1.0): http://explain.depesz.com/s/lYaP
>>
>> Software/Hardware: PGSql 9.2.1, Windows 8.1, 8GB RAM
>> All pgsql settings are at their defaults.
> increase work_mem. per session via set work_mem  = 'xxxMB'; or in
> postgresql.conf, reload.
>
>

Hi Andreas,

The number of rows in the events table isn't constrained, so
unfortunately it isn't feasible to set work_mem high enough to allow an
in-memory sort. Forcing the planner to use the index works to produce a
fast query, so I'm wondering if there is a more general way to getting
the planner to take into account that work_mem isn't big enough to fit
the query which will result in a MUCH more costly external merge.

Thanks,
-Ian


pgsql-performance by date:

Previous
From: Ian Pushee
Date:
Subject: Re: Slow query (planner insisting on using 'external merge' sort type)
Next
From: Igor Neyman
Date:
Subject: Re: Slow query (planner insisting on using 'external merge' sort type)