Re: Possible optimisation: push down SORT and LIMIT nodes

2018-05-30 Thread Justin Pryzby
On Wed, May 30, 2018 at 02:02:31PM -0500, Justin Pryzby wrote: > For diagnostic purposes, I was able to to vastly improve the query runtime > with > a CTE (WITH): I realized this was broken as soon as I sent it (for the essential reason of discarding rows before having sorted them). Sorry for th

Re: Possible optimisation: push down SORT and LIMIT nodes

2018-05-30 Thread Justin Pryzby
On Wed, May 30, 2018 at 03:46:40PM +, Christopher Wilson wrote: > We have a query which is rather slow (about 10 seconds), and it looks like > this: > > The inventory table has the quantity of each asset in the inventory on each > date (complete SQL to create and populate the tables with dumm