|From:||Douglas Doole <dougdoole(at)gmail(dot)com>|
|To:||PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||[PATCH] Push limit to sort through a subquery|
|Views:||Raw Message | Whole Thread | Download mbox|
We've hit a case where pass_down_bound() isn't pushing the row count limit
from limit into sort. The issue is that we're getting a subquery scan node
between the limit and the sort. The subquery is only doing column
projection and has no quals or SRFs so it should be safe to push the limit
into the sort.
The query that hit the problem can be simplified to:
SELECT * FROM (SELECT A,B FROM T ORDER BY C) LIMIT 5
(Yeah, the query's a little screwy in that the ORDER BY should really be
outside the subselect, but it came from a query generator, so that's a
Proposed patch is attached.
|Next Message||Jeff Janes||2017-04-19 01:48:45||Re: Failed recovery with new faster 2PC code|
|Previous Message||Michael Paquier||2017-04-18 22:03:22||Re: Continuous buildfarm failures on hamster with bin-check|