1-- cidr check
2CREATE TABLE cidrtmp AS
3  SELECT cidr(a) AS a FROM inettmp ;
4SET enable_seqscan=on;
5SELECT count(*) FROM cidrtmp WHERE a <  '121.111.63.82';
6 count
7-------
8   290
9(1 row)
10
11SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82';
12 count
13-------
14   291
15(1 row)
16
17SELECT count(*) FROM cidrtmp WHERE a  = '121.111.63.82';
18 count
19-------
20     1
21(1 row)
22
23SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82';
24 count
25-------
26   310
27(1 row)
28
29SELECT count(*) FROM cidrtmp WHERE a >  '121.111.63.82';
30 count
31-------
32   309
33(1 row)
34
35CREATE INDEX cidridx ON cidrtmp USING gist ( a );
36SET enable_seqscan=off;
37SELECT count(*) FROM cidrtmp WHERE a <  '121.111.63.82'::cidr;
38 count
39-------
40   290
41(1 row)
42
43SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82'::cidr;
44 count
45-------
46   291
47(1 row)
48
49SELECT count(*) FROM cidrtmp WHERE a  = '121.111.63.82'::cidr;
50 count
51-------
52     1
53(1 row)
54
55SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82'::cidr;
56 count
57-------
58   310
59(1 row)
60
61SELECT count(*) FROM cidrtmp WHERE a >  '121.111.63.82'::cidr;
62 count
63-------
64   309
65(1 row)
66
67