WL#606: Estimate rows for deactivate_non_unique_index()
LOAD DATA INFILE, CREATE TABLE ... SELECT and INSERT ... SELECT should estimate the number of rows to be inserted in the table and call start_bulk_insert() with this number. For LOAD DATA INFILE one can do this with: file_length / (min-length-of-packed-row) For CREATE TABLE ...SELECT and INSERT ... SELECT this means that this should be done in ::initialize_tables() instead of in ::prepare() as we in the later case have an idea of how many rows there could be in the result set. (Can be stored in join->number_of_records, in sql_select.cc::find_best(), when we update join->best_read) Also, start_bulk_insert() now disables indexes only if there are no rows in the table, otherwise bulk_insert_tree is used. In fact, indexes could be disabled even when table is not empty, if it will give a speedup.
Copyright (c) 2000, 2019, Oracle Corporation and/or its affiliates. All rights reserved.