Marko Tiikkaja <marko.tiikk...@cs.helsinki.fi> writes: > I've previously thought about making the CTE aware of the LIMIT, > similarly to a top-N sort, but I don't think it's worth it.
That approach doesn't lead to a solution because then you could *never* optimize it. The protocol-level limit option is always present. It's conceivable that we could have ExecutorEnd forcibly run any DML CTEs to the end (and fire their triggers?) before shutting down the executor, but it seems like a kluge. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers