Project

General

Profile

« Previous | Next » 

Revision 8334

lib/sql.py: mk_select(): Use subset function when it's available for fast querying at large OFFSET values

View differences:

lib/sql.py
776 776
    assert limit == None or isinstance(limit, (int, long))
777 777
    assert start == None or isinstance(start, (int, long))
778 778
    if limit == 0: order_by = None
779
    if order_by is order_by_pkey:
779
    if order_by in (None, order_by_pkey) and has_subset_func(db, table0):
780
        # can use subset function for fast querying at large OFFSET values
781
        table0 = sql_gen.FunctionCall(table0, limit_=limit, offset_=start)
782
        if limit != 0: limit = None # done by function
783
        start = None # done by function
784
        order_by = None # done by function
785
    elif order_by is order_by_pkey:
780 786
        if lists.is_seq(distinct_on) and distinct_on: order_by = distinct_on[0]
781 787
        elif table0 != None: order_by = table_order_by(db, table0, recover=True)
782 788
        else: order_by = None

Also available in: Unified diff