[Groonga-mysql-commit] mroonga/mroonga at 5fc39cb [master] storage: stop to add WITH_POSITION to index that doesn't use tokenizer

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 18 23:23:14 JST 2016


Kouhei Sutou	2016-03-18 23:23:14 +0900 (Fri, 18 Mar 2016)

  New Revision: 5fc39cb7b4e6f80f5680ce6d665120e566135aa7
  https://github.com/mroonga/mroonga/commit/5fc39cb7b4e6f80f5680ce6d665120e566135aa7

  Message:
    storage: stop to add WITH_POSITION to index that doesn't use tokenizer
    
    It reduces index size.
    
    Index without tokenizer doesn't need to store position
    information. Because there is only one token.

  Modified files:
    ha_mroonga.cpp
    mysql-test/mroonga/storage/column/groonga/index/r/int_other_table.result

  Modified: ha_mroonga.cpp (+8 -3)
===================================================================
--- ha_mroonga.cpp    2016-03-15 22:44:26 +0900 (952e8ab)
+++ ha_mroonga.cpp    2016-03-18 23:23:14 +0900 (465721b)
@@ -3790,7 +3790,7 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name,
 {
   MRN_DBUG_ENTER_METHOD();
   int error = 0;
-  grn_obj *index_table, *index_column;
+  grn_obj *index_column;
   const char *column_name = NULL;
   int column_name_size = 0;
 
@@ -3815,16 +3815,21 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name,
   if (error)
     DBUG_RETURN(error);
 
+  grn_obj *index_table = index_tables[i];
+
   grn_obj_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT;
 
   if (!find_index_column_flags(key_info, &index_column_flags)) {
-    index_column_flags |= GRN_OBJ_WITH_POSITION;
+    grn_obj *tokenizer = grn_obj_get_info(ctx, index_table,
+                                          GRN_INFO_DEFAULT_TOKENIZER, NULL);
+    if (tokenizer) {
+      index_column_flags |= GRN_OBJ_WITH_POSITION;
+    }
     if (is_multiple_column_index) {
       index_column_flags |= GRN_OBJ_WITH_SECTION;
     }
   }
 
-  index_table = index_tables[i];
   const char *index_column_name;
   if (tmp_share->index_table && tmp_share->index_table[i]) {
     index_column_name = key_info->name;

  Modified: mysql-test/mroonga/storage/column/groonga/index/r/int_other_table.result (+1 -1)
===================================================================
--- mysql-test/mroonga/storage/column/groonga/index/r/int_other_table.result    2016-03-15 22:44:26 +0900 (233b9ab)
+++ mysql-test/mroonga/storage/column/groonga/index/r/int_other_table.result    2016-03-18 23:23:14 +0900 (ac47f0f)
@@ -28,7 +28,7 @@ column_create bugs id COLUMN_SCALAR UInt32
 
 column_create bugs priority COLUMN_SCALAR priorities
 
-column_create priorities bugs_priority_index COLUMN_INDEX|WITH_POSITION bugs priority
+column_create priorities bugs_priority_index COLUMN_INDEX bugs priority
 SELECT *
 FROM bugs
 WHERE priority = 3;
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-mysql-commit mailing list
Back to archive index