summaryrefslogtreecommitdiffstats
path: root/contrib/btree_gist/sql/cidr.sql
blob: 9bd77185b96a8ec9913ff15f7927b787a733dbb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- cidr check

CREATE TABLE cidrtmp AS
  SELECT cidr(a) AS a FROM inettmp ;

SET enable_seqscan=on;

SELECT count(*) FROM cidrtmp WHERE a <  '121.111.63.82';

SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82';

SELECT count(*) FROM cidrtmp WHERE a  = '121.111.63.82';

SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82';

SELECT count(*) FROM cidrtmp WHERE a >  '121.111.63.82';

CREATE INDEX cidridx ON cidrtmp USING gist ( a );

SET enable_seqscan=off;

SELECT count(*) FROM cidrtmp WHERE a <  '121.111.63.82'::cidr;

SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82'::cidr;

SELECT count(*) FROM cidrtmp WHERE a  = '121.111.63.82'::cidr;

SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82'::cidr;

SELECT count(*) FROM cidrtmp WHERE a >  '121.111.63.82'::cidr;