On 01/01/2015 12:58 AM, Mark Szidik wrote: > QUERY PLAN
On explain.depesz.com: http://explain.depesz.com/s/Reu The great bulk of the cost is an index-only scan on acl using index acl1, as input to a nested loop. It looks like Pg might be trying to avoid using lots of sort memory. If you, for testing purposes: SET work_mem = '10MB' EXPLAIN (BUFFERS, ANALYZE) SELECT ... do you get a different result? Is it possible that the index is badly bloated? If you can afford the exclusive lock, try `REINDEX`ing acl1. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services