diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-09-20 11:11:24 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-09-24 15:12:34 +0200 |
commit | 00bf18e2bf6a1b57b8ce94a0bf0b5fa6c353bdda (patch) | |
tree | 24e772437ae9d57cc0d689903e676287c0500fd4 /sql/sql_window.cc | |
parent | 2e7a585dddbe7d3fa2ab75776ae1a185ef0c8613 (diff) | |
download | mariadb-git-00bf18e2bf6a1b57b8ce94a0bf0b5fa6c353bdda.tar.gz |
Move table record writing outside of loop
We can set values in the record buffer first and only perform one table
write call at the end. No need to write to file every time one column is
updated.
Also, remove unused method from Table_read_cursor.
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r-- | sql/sql_window.cc | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 4c8190054b0..4bb577a8f5e 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -630,18 +630,6 @@ public: return table->file->ha_rnd_pos(record, curr_rowid); } - bool fetch_prev_row() - { - uchar *p; - if ((p= get_prev_rowid())) - { - int rc= table->file->ha_rnd_pos(record, p); - if (!rc) - return true; // restored ok - } - return false; // didn't restore - } - private: /* The table that is acccesed by this cursor. */ TABLE *table; @@ -2136,14 +2124,11 @@ bool save_window_function_values(List<Item_window_func>& window_functions, tbl->file->ha_rnd_pos(tbl->record[0], rowid_buf); store_record(tbl, record[1]); while (Item_window_func *item_win= iter++) - { - int err; item_win->save_in_field(item_win->result_field, true); - // TODO check if this can be placed outside the loop. - err= tbl->file->ha_update_row(tbl->record[1], tbl->record[0]); - if (err && err != HA_ERR_RECORD_IS_THE_SAME) - return true; - } + + int err= tbl->file->ha_update_row(tbl->record[1], tbl->record[0]); + if (err && err != HA_ERR_RECORD_IS_THE_SAME) + return true; return false; } |