Re: Slow query (planner insisting on using 'external merge' sort type)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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


--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux