[Groonga-commit] pgroonga/pgroonga at df5d4c7 [master] Improve performance for in-operator with empty text[] value

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 19 11:52:36 JST 2017


Kouhei Sutou	2017-06-19 11:52:36 +0900 (Mon, 19 Jun 2017)

  New Revision: df5d4c75a30ae8b3a8ccde179ce4c0f727e8ce0d
  https://github.com/pgroonga/pgroonga/commit/df5d4c75a30ae8b3a8ccde179ce4c0f727e8ce0d

  Message:
    Improve performance for in-operator with empty text[] value

  Added files:
    expected/term-search/text-array/prefix-in/seqscan-empty-array.out
    sql/term-search/text-array/prefix-in/seqscan-empty-array.sql
  Modified files:
    src/pgroonga.c

  Added: expected/term-search/text-array/prefix-in/seqscan-empty-array.out (+18 -0) 100644
===================================================================
--- /dev/null
+++ expected/term-search/text-array/prefix-in/seqscan-empty-array.out    2017-06-19 11:52:36 +0900 (ede43c4)
@@ -0,0 +1,18 @@
+CREATE TABLE tags (
+  names text[]
+);
+INSERT INTO tags VALUES (ARRAY['PostgreSQL', 'PG']);
+INSERT INTO tags VALUES (ARRAY['Groonga', 'grn']);
+INSERT INTO tags VALUES (ARRAY['PGroonga', 'pgrn']);
+INSERT INTO tags VALUES (ARRAY[]::text[]);
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+SELECT names
+  FROM tags
+ WHERE names &^| ARRAY[]::text[];
+ names 
+-------
+(0 rows)
+
+DROP TABLE tags;

  Added: sql/term-search/text-array/prefix-in/seqscan-empty-array.sql (+18 -0) 100644
===================================================================
--- /dev/null
+++ sql/term-search/text-array/prefix-in/seqscan-empty-array.sql    2017-06-19 11:52:36 +0900 (55bd988)
@@ -0,0 +1,18 @@
+CREATE TABLE tags (
+  names text[]
+);
+
+INSERT INTO tags VALUES (ARRAY['PostgreSQL', 'PG']);
+INSERT INTO tags VALUES (ARRAY['Groonga', 'grn']);
+INSERT INTO tags VALUES (ARRAY['PGroonga', 'pgrn']);
+INSERT INTO tags VALUES (ARRAY[]::text[]);
+
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+
+SELECT names
+  FROM tags
+ WHERE names &^| ARRAY[]::text[];
+
+DROP TABLE tags;

  Modified: src/pgroonga.c (+3 -0)
===================================================================
--- src/pgroonga.c    2017-06-19 11:48:17 +0900 (877bdd8)
+++ src/pgroonga.c    2017-06-19 11:52:36 +0900 (a404034)
@@ -1497,6 +1497,9 @@ pgroonga_execute_binary_operator_in_string(const char *operand1,
 {
 	int i, n;
 
+	if (ARR_NDIM(operands2) == 0)
+		return false;
+
 	n = ARR_DIMS(operands2)[0];
 	for (i = 1; i <= n; i++)
 	{
-------------- next part --------------
HTML����������������������������...
다운로드 



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