1 echo create table t1
(f1 tinyint
, f2 smallint
, f3 int
, f4 bigint
, f5 char
(10), f6 varchar
(10), f7
date, f8
time);
3 echo create index hashtiny on t1
(f1
) hash;
5 echo create index hashsmall on t1
(f2
) hash;
7 echo create index hashint on t1
(f3
) hash;
9 echo create index hashbig on t1
(f4
) hash;
11 echo create index hashchar on t1
(f5
) hash;
13 echo create index hashvarchar on t1
(f6
) hash;
15 echo create index hashdate on t1
(f7
) hash;
17 echo create index hashtime on t1
(f8
) hash;
19 Statement Executed
: Rows Affected
= 1
20 Statement Executed
: Rows Affected
= 1
21 Statement Executed
: Rows Affected
= 1
22 Statement Executed
: Rows Affected
= 1
23 Statement Executed
: Rows Affected
= 1
24 echo explain plan
select * from t1
;
27 <ScanType
> TableScan
</ScanType
>
29 echo explain plan
select * from t1 where f1
= 2;
32 <ScanType
> HashScan
</ScanType
>
34 <FieldName1
> f1
</FieldName1
>
35 <CompOp
> Equals
</CompOp
>
36 <OperandPtr
> VALUE
</OperandPtr
>
39 echo explain plan
select * from t1 where f1
< 3;
42 <ScanType
> TableScan
</ScanType
>
44 <FieldName1
> f1
</FieldName1
>
45 <CompOp
> LessThan
</CompOp
>
46 <OperandPtr
> VALUE
</OperandPtr
>
49 echo explain plan
select * from t1 where f2
= 22;
52 <ScanType
> HashScan
</ScanType
>
54 <FieldName1
> f2
</FieldName1
>
55 <CompOp
> Equals
</CompOp
>
56 <OperandPtr
> VALUE
</OperandPtr
>
59 echo explain plan
select * from t1 where f2
> 33;
62 <ScanType
> TableScan
</ScanType
>
64 <FieldName1
> f2
</FieldName1
>
65 <CompOp
> GreaterThan
</CompOp
>
66 <OperandPtr
> VALUE
</OperandPtr
>
69 echo explain plan
select * from t1 where f3
= 333;
72 <ScanType
> HashScan
</ScanType
>
74 <FieldName1
> f3
</FieldName1
>
75 <CompOp
> Equals
</CompOp
>
76 <OperandPtr
> VALUE
</OperandPtr
>
79 echo explain plan
select * from t1 where f3
<> 333;
82 <ScanType
> TableScan
</ScanType
>
84 <FieldName1
> f3
</FieldName1
>
85 <CompOp
> NotEquals
</CompOp
>
86 <OperandPtr
> VALUE
</OperandPtr
>
89 echo explain plan
select * from t1 where f4
= 4444;
92 <ScanType
> HashScan
</ScanType
>
94 <FieldName1
> f4
</FieldName1
>
95 <CompOp
> Equals
</CompOp
>
96 <OperandPtr
> VALUE
</OperandPtr
>
99 echo explain plan
select * from t1 where f4
!= 4444;
102 <ScanType
> TableScan
</ScanType
>
104 <FieldName1
> f4
</FieldName1
>
105 <CompOp
> NotEquals
</CompOp
>
106 <OperandPtr
> VALUE
</OperandPtr
>
109 echo explain plan
select * from t1 where f5
= 'CSQL3';
112 <ScanType
> HashScan
</ScanType
>
114 <FieldName1
> f5
</FieldName1
>
115 <CompOp
> Equals
</CompOp
>
116 <OperandPtr
> VALUE
</OperandPtr
>
119 echo explain plan
select * from t1 where f5
<= 'CSQL3';
122 <ScanType
> TableScan
</ScanType
>
124 <FieldName1
> f5
</FieldName1
>
125 <CompOp
> LessThanEquals
</CompOp
>
126 <OperandPtr
> VALUE
</OperandPtr
>
129 echo explain plan
select * from t1 where f6
= 'Lakshya3';
132 <ScanType
> HashScan
</ScanType
>
134 <FieldName1
> f6
</FieldName1
>
135 <CompOp
> Equals
</CompOp
>
136 <OperandPtr
> VALUE
</OperandPtr
>
139 echo explain plan
select * from t1 where f6
>= 'Lakshya3';
142 <ScanType
> TableScan
</ScanType
>
144 <FieldName1
> f6
</FieldName1
>
145 <CompOp
> GreaterThanEquals
</CompOp
>
146 <OperandPtr
> VALUE
</OperandPtr
>
149 echo explain plan
select * from t1 where f7
= '2003-11-12';
152 <ScanType
> HashScan
</ScanType
>
154 <FieldName1
> f7
</FieldName1
>
155 <CompOp
> Equals
</CompOp
>
156 <OperandPtr
> VALUE
</OperandPtr
>
159 echo explain plan
select * from t1 where f7
> '2003-11-12';
162 <ScanType
> TableScan
</ScanType
>
164 <FieldName1
> f7
</FieldName1
>
165 <CompOp
> GreaterThan
</CompOp
>
166 <OperandPtr
> VALUE
</OperandPtr
>
169 echo explain plan
select * from t1 where f8
= '03:21:00';
172 <ScanType
> HashScan
</ScanType
>
174 <FieldName1
> f8
</FieldName1
>
175 <CompOp
> Equals
</CompOp
>
176 <OperandPtr
> VALUE
</OperandPtr
>
179 echo explain plan
select * from t1 where f8
< '03:21:00';
182 <ScanType
> TableScan
</ScanType
>
184 <FieldName1
> f8
</FieldName1
>
185 <CompOp
> LessThan
</CompOp
>
186 <OperandPtr
> VALUE
</OperandPtr
>