null+****@clear*****
null+****@clear*****
2010年 10月 13日 (水) 22:37:15 JST
Kentoku SHIBA 2010-10-13 13:37:15 +0000 (Wed, 13 Oct 2010)
New Revision: 49ac7ab2df50f99fc4fb0eedb7e9609b562b441c
Log:
#444 add tests
Added files:
test/sql/r/count_performance.result
test/sql/t/count_performance.test
Added: test/sql/r/count_performance.result (+94 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/r/count_performance.result 2010-10-13 13:37:15 +0000 (53c65e0)
@@ -0,0 +1,94 @@
+install plugin groonga soname 'ha_groonga.so';
+set storage_engine=groonga;
+drop table if exists t1, t2, t3;
+create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3));
+insert into t1 values(1,10,"aa ii uu ee oo");
+insert into t1 values(2,20,"ka ki ku ke ko");
+insert into t1 values(3,30,"sa si su se so");
+insert into t1 values(4,40,"ta ti tu te to");
+insert into t1 values(5,50,"aa ii uu ee oo");
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 0
+select * from t1;
+c1 c2 c3
+1 10 aa ii uu ee oo
+2 20 ka ki ku ke ko
+3 30 sa si su se so
+4 40 ta ti tu te to
+5 50 aa ii uu ee oo
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 0
+select count(*) from t1;
+count(*)
+5
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 0
+select * from t1 force index(primary) where c1 between 2 and 4;
+c1 c2 c3
+2 20 ka ki ku ke ko
+3 30 sa si su se so
+4 40 ta ti tu te to
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 0
+select count(*) from t1 force index(primary) where c1 between 2 and 4;
+count(*)
+3
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 1
+select c1 from t1 force index(primary) where c1 < 3;
+c1
+1
+2
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 1
+select count(c1) from t1 force index(primary) where c1 < 3;
+count(c1)
+2
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 1
+select 1 from t1 force index(primary) where c1 > 3;
+1
+1
+1
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 1
+select count(1) from t1 force index(primary) where c1 > 3;
+count(1)
+2
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 2
+select * from t1 where match(c3) against("su");
+c1 c2 c3
+3 30 sa si su se so
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 2
+select count(*) from t1 where match(c3) against("su");
+count(*)
+1
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 3
+select * from t1 where match(c3) against("+su" in boolean mode);
+c1 c2 c3
+3 30 sa si su se so
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 3
+select count(*) from t1 where match(c3) against("+su" in boolean mode);
+count(*)
+1
+show status like 'grn_count_skip';
+Variable_name Value
+grn_count_skip 4
+drop table t1;
+uninstall plugin groonga;
Added: test/sql/t/count_performance.test (+58 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/t/count_performance.test 2010-10-13 13:37:15 +0000 (6c61d46)
@@ -0,0 +1,58 @@
+# Copyright(C) 2010 Kentoku SHIBA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--disable_warnings
+install plugin groonga soname 'ha_groonga.so';
+set storage_engine=groonga;
+drop table if exists t1, t2, t3;
+--enable_warnings
+
+create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3));
+insert into t1 values(1,10,"aa ii uu ee oo");
+insert into t1 values(2,20,"ka ki ku ke ko");
+insert into t1 values(3,30,"sa si su se so");
+insert into t1 values(4,40,"ta ti tu te to");
+insert into t1 values(5,50,"aa ii uu ee oo");
+show status like 'grn_count_skip';
+select * from t1;
+show status like 'grn_count_skip';
+select count(*) from t1;
+show status like 'grn_count_skip';
+select * from t1 force index(primary) where c1 between 2 and 4;
+show status like 'grn_count_skip';
+select count(*) from t1 force index(primary) where c1 between 2 and 4;
+show status like 'grn_count_skip';
+select c1 from t1 force index(primary) where c1 < 3;
+show status like 'grn_count_skip';
+select count(c1) from t1 force index(primary) where c1 < 3;
+show status like 'grn_count_skip';
+select 1 from t1 force index(primary) where c1 > 3;
+show status like 'grn_count_skip';
+select count(1) from t1 force index(primary) where c1 > 3;
+show status like 'grn_count_skip';
+select * from t1 where match(c3) against("su");
+show status like 'grn_count_skip';
+select count(*) from t1 where match(c3) against("su");
+show status like 'grn_count_skip';
+select * from t1 where match(c3) against("+su" in boolean mode);
+show status like 'grn_count_skip';
+select count(*) from t1 where match(c3) against("+su" in boolean mode);
+show status like 'grn_count_skip';
+drop table t1;
+
+--disable_warnings
+uninstall plugin groonga;
+--enable_warnings