[Groonga-commit] groonga/groonga at be7c223 [master] logical_range_filter: use at most 1% data for range index

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Nov 14 19:04:02 JST 2015


Kouhei Sutou	2015-11-14 19:04:02 +0900 (Sat, 14 Nov 2015)

  New Revision: be7c22340ede52217d973d7b6dda1ebbf7d76cbf
  https://github.com/groonga/groonga/commit/be7c22340ede52217d973d7b6dda1ebbf7d76cbf

  Message:
    logical_range_filter: use at most 1% data for range index

  Modified files:
    plugins/sharding/logical_range_filter.rb

  Modified: plugins/sharding/logical_range_filter.rb (+15 -1)
===================================================================
--- plugins/sharding/logical_range_filter.rb    2015-11-14 18:51:39 +0900 (9efe7c1)
+++ plugins/sharding/logical_range_filter.rb    2015-11-14 19:04:02 +0900 (85fb295)
@@ -507,7 +507,9 @@ module Groonga
               else
                 options[:limit] = current_limit
               end
-              max_n_unmatched_records = options[:limit] * 100
+              max_n_unmatched_records =
+                compute_max_n_unmatched_records(data_table.size,
+                                                options[:limit])
               options[:max_n_unmatched_records] = max_n_unmatched_records
               if @filter
                 create_expression(data_table) do |expression|
@@ -577,6 +579,18 @@ module Groonga
           flags
         end
 
+        def compute_max_n_unmatched_records(data_table_size, limit)
+          max_n_unmatched_records = limit * 100
+          max_n_sample_records = data_table_size
+          if max_n_sample_records > 10000
+            max_n_sample_records /= 100
+          end
+          if max_n_unmatched_records > max_n_sample_records
+            max_n_unmatched_records = max_n_sample_records
+          end
+          max_n_unmatched_records
+        end
+
         def filter_table
           table =****@shard*****
           create_expression(table) do |expression|
-------------- next part --------------
HTML����������������������������...
다운로드 



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