Project

General

Profile

« Previous | Next » 

Revision 10843

bugfix: lib/sql_io.py: put_table(): DuplicateKeyException: need to include any index cond in the join condition, so that an index scan can be used instead of a much slower full-table sort (otherwise the query planner will not know that it can restrict results to rows satisfying the index cond)

View differences:

lib/sql_io.py
744 744
            # filtered out separately upon insert.)
745 745
            insert_in_table = sql.distinct_table(db, insert_in_table,
746 746
                join_cols.values(), [insert_in_table,
747
                sql_gen.Join(out_table, join_cols, sql_gen.filter_out)])
747
                sql_gen.Join(out_table, join_cols, sql_gen.filter_out, e.cond)])
748 748
            insert_in_tables.append(insert_in_table)
749 749
        except sql.NullValueException, e:
750 750
            if not log_exc(e): break

Also available in: Unified diff