regression=#
regression=#
regression=# create index inet_idx1 on inet_tbl(i);
CREATE INDEX
regression=# set enable_seqscan to off;
SET
regression=# explain select * from inet_tbl where
i<<'192.168.1.0/24'::cidr; QUERY
PLAN
-------------------------------------------------------------------------------Index Scan using inet_idx1 on inet_tbl
(cost=0.00..4.68rows=7
width=64) Index Cond: ((i > '192.168.1.0/24'::inet) AND (i <=
'192.168.1.255'::inet)) Filter: (i << '192.168.1.0/24'::inet)
(3 rows)
regression=# select * from inet_tbl where i<<'192.168.1.0/24'::cidr; c | i
----------------+------------------192.168.1.0/24 | 192.168.1.0/25192.168.1.0/24 | 192.168.1.255/25192.168.1.0/24 |
192.168.1.226
(3 rows)
On Wed, 2003-01-15 at 14:58, Tom Lane wrote:
> Rod Taylor <rbt@rbt.ca> writes:
> > Looks like some ORDER BY statements would be useful.
>
> To do what? Those queries should already be producing indexscan plans.
> If you're not getting the expected answers, there is something that
> needs to be fixed, not papered over.
>
> Please try
>
> create index inet_idx1 on inet_tbl(i);
> set enable_seqscan to off;
> explain select * from inet_tbl where i<<'192.168.1.0/24'::cidr;
>
> regards, tom lane
--
Rod Taylor <rbt@rbt.ca>
PGP Key: http://www.rbt.ca/rbtpub.asc