Revision 8223
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sql.py | ||
---|---|---|
1258 | 1258 |
except StopIteration: return table_pkey_index(db, table, recover) |
1259 | 1259 |
|
1260 | 1260 |
def table_order_by(db, table, recover=None): |
1261 |
''' |
|
1262 |
@return None if table is view, because table_cluster_on() would return None |
|
1263 |
''' |
|
1261 | 1264 |
if table.order_by == None: |
1262 | 1265 |
try: table.order_by = index_order_by(db, table_cluster_on(db, table, |
1263 | 1266 |
recover)) |
Also available in: Unified diff
lib/sql.py: table_order_by(): Documented that it returns None if table is a view, because table_cluster_on() would return None. This is necessary for inputs/FIA/occurrence_all/ sorting to work correctly, because specifying a manual sort order would prevent the query planner from just using fast nested loop joins and instead cause it to perform a slow sort. (This appears to be a bug in the query planner, because when the column list specified matches the joined-on indexes, there should be no need for post-nested loop re-sorting.)