On Monday, August 4, 2014 11:59:36 PM UTC-4, Michael Bayer wrote:
>
>
> ah because ROW_NUMBER() needs…the row number!   that is, we need to count 
> the rows between PK values.   Well if you have truly increment-by-one 
> primary keys and that’s what you’re windowing on, you can make that the 
> “rownum”…otherwise, you’re looking for windows of N rows within the whole 
> set of rows.  Counting is necessary, I’m not sure how to force it to use an 
> index-only scan to figure this out.   I haven’t looked into this that 
> deeply. 
>

Yeah, I played with it for a while and dug deep into some psql listserves 
and dba forums trying to trick it.  i might jump on the postgres list for 
some insight next.  
 

> add a WHERE clause to the query that is selecting the windows, that is 
> instead of: 
>

i ended up cobbling one together to do that.  though to eek out a bit of 
better performance, i used a series of temp tables.  

i was just wondering if anyone had pulled together a drop-in recipe yet 
that inspected the base-query for any filters, and pushed that into the 
'select' that generates the iterables.  


 
 

>  

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to