Kouhei Sutou
null+****@clear*****
Thu Apr 9 11:25:14 JST 2015
Kouhei Sutou 2015-04-09 11:25:14 +0900 (Thu, 09 Apr 2015) New Revision: 7824db9dd3b983c0ff763c064293444eea2fc3e6 https://github.com/mroonga/mroonga/commit/7824db9dd3b983c0ff763c064293444eea2fc3e6 Message: storage: improve performance to estimate the # of records in range Before: Mroonga counts real the # number of records in range. After: Mroonga just returns estimated the # number of records in range. It requires Groonga 5.0.2 or later. [groonga-dev,03150] Reported by Masato Shimada. Thanks!!! Modified files: ha_mroonga.cpp packages/source/Makefile.am required_groonga_version Modified: ha_mroonga.cpp (+3 -8) =================================================================== --- ha_mroonga.cpp 2015-04-07 22:16:35 +0900 (c657e5d) +++ ha_mroonga.cpp 2015-04-09 11:25:14 +0900 (2a3c14a) @@ -6801,18 +6801,13 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min, } grn_table_cursor *cursor; - grn_table_cursor *index_cursor; cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], key_min, size_min, key_max, size_max, 0, -1, flags); - index_cursor = grn_index_cursor_open(ctx, cursor, - grn_index_columns[key_nr], - 0, GRN_ID_MAX, 0); - while (grn_table_cursor_next(ctx, index_cursor) != GRN_ID_NIL) { - row_count++; - } - grn_obj_unlink(ctx, index_cursor); + grn_obj *index_column = grn_index_columns[key_nr]; + grn_ii *ii = reinterpret_cast<grn_ii *>(index_column); + row_count = grn_ii_estimate_size_for_lexicon_cursor(ctx, ii, cursor); grn_table_cursor_close(ctx, cursor); } DBUG_RETURN(row_count); Modified: packages/source/Makefile.am (+1 -1) =================================================================== --- packages/source/Makefile.am 2015-04-07 22:16:35 +0900 (f43aef7) +++ packages/source/Makefile.am 2015-04-09 11:25:14 +0900 (f9da323) @@ -1,7 +1,7 @@ MROONGA_BASE = $(PACKAGE)-$(VERSION) MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz -GROONGA_VERSION = 5.0.1 +GROONGA_VERSION = 5.0.2 GROONGA_BASE = groonga-$(GROONGA_VERSION) GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz Modified: required_groonga_version (+1 -1) =================================================================== --- required_groonga_version 2015-04-07 22:16:35 +0900 (0062ac9) +++ required_groonga_version 2015-04-09 11:25:14 +0900 (a1ef0ca) @@ -1 +1 @@ -5.0.0 +5.0.2 -------------- next part -------------- HTML����������������������������...Download